Lines Matching defs:uMsr

52     uint32_t        uMsr;
125 uint32_t uMsr, uint64_t uValue, uint32_t fFlags)
148 pEntry->uMsr = uMsr;
212 static bool msrProberWrite(uint32_t uMsr, uint64_t uValue)
215 int rc = SUPR3MsrProberWrite(uMsr, NIL_RTCPUID, uValue, &fGp);
221 static bool msrProberRead(uint32_t uMsr, uint64_t *puValue)
225 int rc = SUPR3MsrProberRead(uMsr, NIL_RTCPUID, puValue, &fGp);
232 static bool msrProberModifyNoChange(uint32_t uMsr)
235 int rc = SUPR3MsrProberModify(uMsr, NIL_RTCPUID, UINT64_MAX, 0, &Result);
245 static bool msrProberModifyZero(uint32_t uMsr)
248 int rc = SUPR3MsrProberModify(uMsr, NIL_RTCPUID, 0, 0, &Result);
261 * @param uMsr The MSR.
266 static int msrProberModifyBitChanges(uint32_t uMsr, uint64_t *pfIgnMask, uint64_t *pfGpMask, uint64_t fSkipMask)
276 int rc = SUPR3MsrProberModify(uMsr, NIL_RTCPUID, ~fBitMask, fBitMask, &ResultSet);
278 return RTMsgErrorRc(rc, "SUPR3MsrProberModify(%#x,,%#llx,%#llx,): %Rrc", uMsr, ~fBitMask, fBitMask, rc);
282 rc = SUPR3MsrProberModify(uMsr, NIL_RTCPUID, ~fBitMask, 0, &ResultClear);
284 return RTMsgErrorRc(rc, "SUPR3MsrProberModify(%#x,,%#llx,%#llx,): %Rrc", uMsr, ~fBitMask, 0, rc);
309 * @param uMsr The MSR.
312 static int msrProberModifyBit(uint32_t uMsr, unsigned iBit)
318 int rc = SUPR3MsrProberModify(uMsr, NIL_RTCPUID, ~fBitMask, fBitMask, &ResultSet);
320 return RTMsgErrorRc(-2, "SUPR3MsrProberModify(%#x,,%#llx,%#llx,): %Rrc", uMsr, ~fBitMask, fBitMask, rc);
324 rc = SUPR3MsrProberModify(uMsr, NIL_RTCPUID, ~fBitMask, 0, &ResultClear);
326 return RTMsgErrorRc(-2, "SUPR3MsrProberModify(%#x,,%#llx,%#llx,): %Rrc", uMsr, ~fBitMask, 0, rc);
349 * @param uMsr The MSR.
353 static bool msrProberModifySimpleGp(uint32_t uMsr, uint64_t fAndMask, uint64_t fOrMask)
356 int rc = SUPR3MsrProberModify(uMsr, NIL_RTCPUID, fAndMask, fOrMask, &Result);
359 RTMsgError("SUPR3MsrProberModify(%#x,,%#llx,%#llx,): %Rrc", uMsr, fAndMask, fOrMask, rc);
375 * @param uMsr The MSR.
383 static int msrProberModifyBasicTests(uint32_t uMsr, uint64_t fSkipMask, bool *pfReadOnly, uint64_t *pfIgnMask, uint64_t *pfGpMask)
385 if (msrProberModifyNoChange(uMsr))
390 return msrProberModifyBitChanges(uMsr, pfIgnMask, pfGpMask, fSkipMask);
445 vbCpuRepDebug("MSR AND mask: quit on iBit=%u uMsr=%#x (%#x) %llx != %llx => fMsrMask=%#x\n",
491 uint32_t uMsr = s_aRanges[i].uFirst;
492 if ((uMsr & fMsrMask) != uMsr)
495 while (cLeft-- > 0 && (uMsr & fMsrMask) == uMsr)
497 if ((uMsr & 0xfff) == 0)
499 vbCpuRepDebug("testing %#x...\n", uMsr);
503 else if (uMsr >= 0x00003170 && uMsr <= 0xc0000090)
505 vbCpuRepDebug("testing %#x...\n", uMsr);
510 if ((uMsr >= 0xc0011012 && uMsr <= 0xc0011013) && g_enmVendor == CPUMCPUVENDOR_AMD)
511 vbCpuRepDebug("Skipping %#x\n", uMsr);
517 int rc = SUPR3MsrProberRead(uMsr, NIL_RTCPUID, &uValue, &fGp);
522 return RTMsgErrorRc(rc, "SUPR3MsrProberRead failed on %#x: %Rrc\n", uMsr, rc);
529 else if (uMsr == 0x0000317e && g_enmVendor == CPUMCPUVENDOR_VIA)
534 || (*ppaMsrs)[*pcMsrs - 1].uMsr != 0x0000317d
541 if (uMsr >= 0x00003170 && uMsr <= 0xc0000090)
543 vbCpuRepDebug("test writing %#x...\n", uMsr);
548 rc = SUPR3MsrProberWrite(uMsr, NIL_RTCPUID, 0, &fGp);
553 return RTMsgErrorRc(rc, "SUPR3MsrProberWrite failed on %#x: %Rrc\n", uMsr, rc);
563 if ( uMsr == 0x00000079
568 if ( uMsr == 0xc0010020
578 rc = vbCpuRepMsrsAddOne(ppaMsrs, pcMsrs, uMsr, uValue, fFlags);
580 return RTMsgErrorRc(rc, "Out of memory (uMsr=%#x).\n", uMsr);
584 vbCpuRepDebug("%#010x: uValue=%#llx fFlags=%#x\n", uMsr, uValue, fFlags);
588 uMsr++;
602 * @param uMsr The MSR in question.
604 static const char *getMsrNameHandled(uint32_t uMsr)
607 switch (uMsr)
1589 switch (uMsr)
1652 switch (uMsr)
1712 switch (uMsr)
1752 * @param uMsr The MSR in question.
1754 static const char *getMsrName(uint32_t uMsr)
1756 const char *pszReadOnly = getMsrNameHandled(uMsr);
1764 RTStrPrintf(s_szBuf, sizeof(s_szBuf), "TODO_%04x_%04x", RT_HI_U16(uMsr), RT_LO_U16(uMsr));
1777 * @param uMsr The first MSR in the range.
1779 static const char *getMsrRangeName(uint32_t uMsr)
1781 switch (uMsr)
1815 const char *pszReadOnly = getMsrNameHandled(uMsr);
1836 RTStrPrintf(s_szBuf, sizeof(s_szBuf), "TODO_%04x_%04x_n", RT_HI_U16(uMsr), RT_LO_U16(uMsr));
1846 * @param uMsr The MSR in question.
1850 static const char *getMsrFnName(uint32_t uMsr, bool *pfTakesValue)
1858 switch (uMsr)
2278 * @returns The variable name @a uMsr corresponds to, NULL if no variable.
2279 * @param uMsr The MSR in question.
2281 static const char *getMsrCpumCpuVarName(uint32_t uMsr)
2283 switch (uMsr)
2307 * @param uMsr The MSR.
2309 static bool doesMsrReadAsZero(uint32_t uMsr)
2311 switch (uMsr)
2346 * @param uMsr The MSR.
2348 static uint64_t getGenericSkipMask(uint32_t uMsr)
2350 switch (uMsr)
2418 * @param uMsr The MSR in question.
2420 static VBCPUREPBADNESS queryMsrWriteBadness(uint32_t uMsr)
2426 switch (uMsr)
2503 * @param uMsr The MSR.
2507 static bool isMsrViaDummy(uint32_t uMsr, uint64_t uValue, uint32_t fFlags)
2518 switch (uMsr)
2539 if (uMsr >= 0x00001200 && uMsr <= 0x00003fff && queryMsrWriteBadness(uMsr) != VBCPUREPBADNESS_MOSTLY_HARMLESS)
2542 if ( !msrProberModifyNoChange(uMsr)
2543 && !msrProberModifyZero(uMsr))
2548 int rc = msrProberModifyBitChanges(uMsr, &fIgnMask, &fGpMask, 0);
2564 * @param uMsr The MSR.
2568 static void adjustCanonicalIgnAndGpMasks(uint32_t uMsr, uint64_t *pfIgn, uint64_t *pfGp)
2572 switch (uMsr)
2642 static int printMsrWriteOnly(uint32_t uMsr, const char *pszWrFnName, const char *pszAnnotation)
2649 uMsr, getMsrName(uMsr), pszWrFnName, pszAnnotation);
2655 static int printMsrValueReadOnly(uint32_t uMsr, uint64_t uValue, const char *pszAnnotation)
2657 vbCpuRepPrintf(" MVO(%#010x, \"%s\"", uMsr, getMsrName(uMsr));
2668 static int printMsrValueIgnoreWritesNamed(uint32_t uMsr, uint64_t uValue, const char *pszName, const char *pszAnnotation)
2670 vbCpuRepPrintf(" MVI(%#010x, \"%s\"", uMsr, pszName);
2680 static int printMsrValueIgnoreWrites(uint32_t uMsr, uint64_t uValue, const char *pszAnnotation)
2682 return printMsrValueIgnoreWritesNamed(uMsr, uValue, getMsrName(uMsr), pszAnnotation);
2686 static int printMsrValueExtended(uint32_t uMsr, uint64_t uValue, uint64_t fIgnMask, uint64_t fGpMask,
2689 vbCpuRepPrintf(" MVX(%#010x, \"%s\"", uMsr, getMsrName(uMsr));
2701 static int printMsrRangeValueReadOnly(uint32_t uMsr, uint32_t uLast, uint64_t uValue, const char *pszAnnotation)
2703 vbCpuRepPrintf(" RVO(%#010x, %#010x, \"%s\"", uMsr, uLast, getMsrRangeName(uMsr));
2713 static int printMsrRangeValueIgnoreWritesNamed(uint32_t uMsr, uint32_t uLast, uint64_t uValue, const char *pszName, const char *pszAnnotation)
2715 vbCpuRepPrintf(" RVI(%#010x, %#010x, \"%s\"", uMsr, uLast, pszName);
2725 static int printMsrRangeValueIgnoreWrites(uint32_t uMsr, uint32_t uLast, uint64_t uValue, const char *pszAnnotation)
2727 return printMsrRangeValueIgnoreWritesNamed(uMsr, uLast, uValue, getMsrRangeName(uMsr), pszAnnotation);
2731 static int printMsrFunction(uint32_t uMsr, const char *pszRdFnName, const char *pszWrFnName, const char *pszAnnotation)
2734 pszRdFnName = getMsrFnName(uMsr, NULL);
2737 vbCpuRepPrintf(" MFN(%#010x, \"%s\", %s, %s),", uMsr, getMsrName(uMsr), pszRdFnName, pszWrFnName);
2745 static int printMsrFunctionReadOnly(uint32_t uMsr, const char *pszRdFnName, const char *pszAnnotation)
2748 pszRdFnName = getMsrFnName(uMsr, NULL);
2749 vbCpuRepPrintf(" MFO(%#010x, \"%s\", %s),", uMsr, getMsrName(uMsr), pszRdFnName);
2757 static int printMsrFunctionIgnoreWrites(uint32_t uMsr, const char *pszRdFnName, const char *pszAnnotation)
2760 pszRdFnName = getMsrFnName(uMsr, NULL);
2761 vbCpuRepPrintf(" MFI(%#010x, \"%s\", %s),", uMsr, getMsrName(uMsr), pszRdFnName);
2769 static int printMsrFunctionIgnoreMask(uint32_t uMsr, const char *pszRdFnName, const char *pszWrFnName,
2773 pszRdFnName = getMsrFnName(uMsr, NULL);
2776 vbCpuRepPrintf(" MFW(%#010x, \"%s\", %s, %s", uMsr, getMsrName(uMsr), pszRdFnName, pszWrFnName);
2786 static int printMsrFunctionExtended(uint32_t uMsr, const char *pszRdFnName, const char *pszWrFnName, uint64_t uValue,
2790 pszRdFnName = getMsrFnName(uMsr, NULL);
2793 vbCpuRepPrintf(" MFX(%#010x, \"%s\", %s, %s", uMsr, getMsrName(uMsr), pszRdFnName, pszWrFnName);
2805 static int printMsrFunctionExtendedIdxVal(uint32_t uMsr, const char *pszRdFnName, const char *pszWrFnName, uint64_t uValue,
2809 pszRdFnName = getMsrFnName(uMsr, NULL);
2812 vbCpuRepPrintf(" MFX(%#010x, \"%s\", %s, %s, %#x", uMsr, getMsrName(uMsr), pszRdFnName, pszWrFnName, uValue);
2823 static int printMsrFunctionCpumCpu(uint32_t uMsr, const char *pszRdFnName, const char *pszWrFnName,
2827 pszRdFnName = getMsrFnName(uMsr, NULL);
2831 pszCpumCpuStorage = getMsrCpumCpuVarName(uMsr);
2833 return RTMsgErrorRc(VERR_NOT_FOUND, "Missing CPUMCPU member for %#s (%#x)\n", getMsrName(uMsr), uMsr);
2834 vbCpuRepPrintf(" MFS(%#010x, \"%s\", %s, %s, %s),", uMsr, getMsrName(uMsr), pszRdFnName, pszWrFnName, pszCpumCpuStorage);
2842 static int printMsrFunctionCpumCpuEx(uint32_t uMsr, const char *pszRdFnName, const char *pszWrFnName,
2847 pszRdFnName = getMsrFnName(uMsr, NULL);
2851 pszCpumCpuStorage = getMsrCpumCpuVarName(uMsr);
2853 return RTMsgErrorRc(VERR_NOT_FOUND, "Missing CPUMCPU member for %#s (%#x)\n", getMsrName(uMsr), uMsr);
2854 vbCpuRepPrintf(" MFZ(%#010x, \"%s\", %s, %s, %s", uMsr, getMsrName(uMsr), pszRdFnName, pszWrFnName, pszCpumCpuStorage);
2865 static int printMsrRangeFunction(uint32_t uMsr, uint32_t uLast, const char *pszRdFnName, const char *pszWrFnName,
2869 pszRdFnName = getMsrFnName(uMsr, NULL);
2872 vbCpuRepPrintf(" RFN(%#010x, %#010x, \"%s\", %s, %s),", uMsr, uLast, getMsrRangeName(uMsr), pszRdFnName, pszWrFnName);
2880 static int printMsrRangeFunctionEx(uint32_t uMsr, uint32_t uLast, const char *pszRdFnName, const char *pszWrFnName,
2884 pszRdFnName = getMsrFnName(uMsr, NULL);
2887 vbCpuRepPrintf(" RSN(%#010x, %#010x, \"%s\", %s, %s", uMsr, uLast, getMsrRangeName(uMsr), pszRdFnName, pszWrFnName);
2899 static int printMsrRangeFunctionExIdxVal(uint32_t uMsr, uint32_t uLast, const char *pszRdFnName, const char *pszWrFnName,
2903 pszRdFnName = getMsrFnName(uMsr, NULL);
2907 uMsr, uLast, getMsrRangeName(uMsr), pszRdFnName, pszWrFnName, uValue);
2918 static int printMsrAlias(uint32_t uMsr, uint32_t uTarget, const char *pszAnnotation)
2920 vbCpuRepPrintf(" MAL(%#010x, \"%s\", %#010x),", uMsr, getMsrName(uMsr), uTarget);
2961 static int reportMsr_Generic(uint32_t uMsr, uint32_t fFlags, uint64_t uValue)
2965 const char *pszFnName = getMsrFnName(uMsr, &fTakesValue);
2968 rc = printMsrWriteOnly(uMsr, pszFnName, NULL);
2971 bool fReadAsZero = doesMsrReadAsZero(uMsr);
2975 switch (queryMsrWriteBadness(uMsr))
2980 if ( msrProberModifyNoChange(uMsr)
2981 || msrProberModifyZero(uMsr))
2983 uint64_t fSkipMask = getGenericSkipMask(uMsr);
2986 rc = msrProberModifyBitChanges(uMsr, &fIgnMask, &fGpMask, fSkipMask);
2989 adjustCanonicalIgnAndGpMasks(uMsr, &fIgnMask, &fGpMask);
2994 rc = printMsrFunctionIgnoreWrites(uMsr, pszFnName, annotateValue(uValue));
2996 rc = printMsrFunction(uMsr, pszFnName, pszFnName, annotateValue(uValue));
2998 rc = printMsrFunctionExtended(uMsr, pszFnName, pszFnName, fTakesValue ? uValue : 0,
3002 rc = printMsrValueIgnoreWrites(uMsr, fReadAsZero ? 0 : uValue, fReadAsZero ? annotateValue(uValue) : NULL);
3004 rc = printMsrValueExtended(uMsr, fReadAsZero ? 0 : uValue, fIgnMask, fGpMask,
3009 rc = printMsrFunctionReadOnly(uMsr, pszFnName, annotateValue(uValue));
3011 rc = printMsrFunctionExtended(uMsr, pszFnName, "ReadOnly", uValue, 0, 0, annotateValue(uValue));
3013 rc = printMsrValueReadOnly(uMsr, 0, annotateValue(uValue));
3015 rc = printMsrValueReadOnly(uMsr, uValue, NULL);
3022 if (msrProberModifyNoChange(uMsr))
3025 rc = printMsrFunction(uMsr, pszFnName, pszFnName, annotateValueExtra("Might bite.", uValue));
3027 rc = printMsrFunctionExtended(uMsr, pszFnName, pszFnName, uValue, 0, 0,
3030 rc = printMsrValueIgnoreWrites(uMsr, 0, annotateValueExtra("Might bite.", uValue));
3032 rc = printMsrValueIgnoreWrites(uMsr, uValue, "Might bite.");
3035 rc = printMsrFunctionReadOnly(uMsr, pszFnName, annotateValueExtra("Might bite.", uValue));
3037 rc = printMsrFunctionExtended(uMsr, pszFnName, "ReadOnly", uValue, 0, UINT64_MAX,
3040 rc = printMsrValueReadOnly(uMsr, 0, annotateValueExtra("Might bite.", uValue));
3042 rc = printMsrValueReadOnly(uMsr, uValue, "Might bite.");
3050 rc = printMsrFunction(uMsr, pszFnName, pszFnName, annotateValueExtra("Villain?", uValue));
3052 rc = printMsrFunctionExtended(uMsr, pszFnName, pszFnName, uValue, 0, 0,
3055 rc = printMsrValueIgnoreWrites(uMsr, 0, annotateValueExtra("Villain?", uValue));
3057 rc = printMsrValueIgnoreWrites(uMsr, uValue, "Villain?");
3069 uint32_t uMsr = paMsrs[0].uMsr;
3070 uint32_t iRange = uMsr - uMsrBase;
3077 pszRdWrFnName = getMsrFnName(uMsr, NULL);
3079 return RTMsgErrorRc(VERR_INVALID_PARAMETER, "uMsr=%#x no function name\n", uMsr);
3087 && paMsrs[cRegs].uMsr == uMsr + cRegs)
3094 int rc = msrProberModifyBasicTests(uMsr, fSkipMask, &fReadOnly0, &fIgnMask0, &fGpMask0);
3103 rc = msrProberModifyBasicTests(paMsrs[i].uMsr, fSkipMask, &fReadOnlyN, &fIgnMaskN, &fGpMaskN);
3110 if (!fEarlyEndOk && !isMsrViaDummy(uMsr, paMsrs[i].uValue, paMsrs[i].fFlags))
3113 getMsrNameHandled(uMsr), uMsr, paMsrs[i].uMsr,
3133 return printMsrFunctionExtendedIdxVal(uMsr, pszRdWrFnName, fReadOnly0 ? "ReadOnly" : pszRdWrFnName,
3137 return printMsrRangeFunction(uMsr, uMsr + cRegs - 1,
3140 return printMsrRangeFunctionExIdxVal(uMsr, uMsr + cRegs - 1, pszRdWrFnName, fReadOnly0 ? "ReadOnly" : pszRdWrFnName,
3148 return reportMsr_GenRangeFunctionEx(paMsrs, cMsrs, cMax, pszRdWrFnName, paMsrs[0].uMsr, false /*fEarlyEndOk*/, false /*fNoIgnMask*/,
3149 getGenericSkipMask(paMsrs[0].uMsr), pidxLoop);
3157 * @param uMsr The MSR.
3165 static int reportMsr_GenFunctionEx(uint32_t uMsr, const char *pszRdWrFnName, uint32_t uValue,
3171 pszRdWrFnName = getMsrFnName(uMsr, NULL);
3173 return RTMsgErrorRc(VERR_INVALID_PARAMETER, "uMsr=%#x no function name\n", uMsr);
3179 int rc = msrProberModifyBitChanges(uMsr, &fIgnMask, &fGpMask, fSkipMask);
3184 if (fGpMask == UINT64_MAX && uValue == 0 && !msrProberModifyZero(uMsr))
3185 rc = printMsrFunctionReadOnly(uMsr, pszRdWrFnName, pszAnnotate);
3187 rc = printMsrFunctionIgnoreWrites(uMsr, pszRdWrFnName, pszAnnotate);
3189 rc = printMsrFunctionIgnoreMask(uMsr, pszRdWrFnName, NULL, fIgnMask, pszAnnotate);
3191 rc = printMsrFunction(uMsr, pszRdWrFnName, NULL, pszAnnotate);
3193 rc = printMsrFunctionExtended(uMsr, pszRdWrFnName, NULL, uValue, fIgnMask, fGpMask, pszAnnotate);
3211 uint32_t uMsr = paMsrs[0].uMsr;
3214 && paMsrs[cRegs].uMsr == uMsr + cRegs
3215 && isMsrViaDummy(paMsrs[cRegs].uMsr, paMsrs[cRegs].uValue, paMsrs[cRegs].fFlags))
3219 vbCpuRepDebug("VIA dummy detection %#llx..%#llx (%#x regs)...\n", uMsr, uMsr + cRegs - 1, cRegs);
3229 RTStrPrintf(szName, sizeof(szName), "ZERO_%04x_%04x", RT_HI_U16(uMsr), RT_LO_U16(uMsr));
3230 return printMsrValueIgnoreWritesNamed(uMsr, 0, szName, NULL);
3233 uint32_t uMsrLast = uMsr + cRegs - 1;
3235 RT_HI_U16(uMsr), RT_LO_U16(uMsr), RT_HI_U16(uMsrLast), RT_LO_U16(uMsrLast));
3236 return printMsrRangeValueIgnoreWritesNamed(uMsr, uMsrLast, 0, szName, NULL);
3245 * @param uMsr The MSR number.
3248 static int reportMsr_Ia32ApicBase(uint32_t uMsr, uint64_t uValue)
3255 return reportMsr_GenFunctionEx(uMsr, "Ia32ApicBase", uValue, fSkipMask, 0, NULL);
3264 * @param uMsr The MSR number.
3267 static int reportMsr_Ia32MiscEnable(uint32_t uMsr, uint64_t uValue)
3290 int rc = msrProberModifyBitChanges(uMsr, &fIgnMask, &fGpMask, fSkipMask);
3292 rc = printMsrFunctionExtended(uMsr, "Ia32MiscEnable", "Ia32MiscEnable", uValue,
3302 * @param uMsr The MSR.
3306 static int msrVerifyMtrrTypeGPs(uint32_t uMsr, uint32_t iBit, uint32_t cExpected)
3311 bool fGp = !msrProberModifySimpleGp(uMsr, ~(UINT64_C(0xff) << iBit), (uint64_t)uEndTypes << iBit);
3314 uEndTypes, uMsr);
3321 uEndTypes, uMsr, cExpected);
3337 uint32_t uMsr = paMsrs[0].uMsr;
3342 && paMsrs[cRegs].uMsr == uMsr + cRegs
3343 && !isMsrViaDummy(paMsrs[cRegs].uMsr, paMsrs[cRegs].uValue, paMsrs[cRegs].fFlags) )
3357 vbCpuRepDebug("iGuineaPig=%#x -> %#x\n", iGuineaPig, uMsr + iGuineaPig);
3362 int rc = msrProberModifyBitChanges(uMsr + iGuineaPig, &fIgnBase, &fGpBase, 0);
3365 rc = msrVerifyMtrrTypeGPs(uMsr + iGuineaPig, 0, 7);
3373 rc = msrProberModifyBitChanges(uMsr + iGuineaPig + 1, &fIgnMask, &fGpMask, 0x800); /* enabling it may cause trouble */
3392 rc = msrVerifyMtrrTypeGPs(uMsr + iGuineaPig, 0, 7);
3399 rc = msrProberModifyBitChanges(uMsr + i, &fIgnBaseN, &fGpBaseN, fSkipBase);
3407 uMsr + i, uMsr + iGuineaPig,
3412 rc = msrProberModifyBitChanges(uMsr + i + 1, &fIgnMaskN, &fGpMaskN, fSkipMask);
3419 uMsr + i + 1, uMsr + iGuineaPig + 1,
3427 printMsrFunctionExtendedIdxVal(uMsr + i, "Ia32MtrrPhysBaseN", NULL, i / 2, fIgnBase, fGpBase,
3429 printMsrFunctionExtendedIdxVal(uMsr + i + 1, "Ia32MtrrPhysMaskN", NULL, i / 2, fIgnMask, fGpMask,
3442 * @param uMsr The MSR.
3444 static int reportMsr_Ia32MtrrFixedOrPat(uint32_t uMsr)
3448 if ( uMsr != 0x00000277
3458 int rc = msrVerifyMtrrTypeGPs(uMsr, iBit, 7 + (uMsr == 0x00000277));
3464 return printMsrFunctionCpumCpu(uMsr, NULL, NULL, NULL, NULL);
3472 * @param uMsr The MSR.
3474 static int reportMsr_Ia32MtrrDefType(uint32_t uMsr)
3486 int rc = msrVerifyMtrrTypeGPs(uMsr, 0, 7);
3490 rc = msrProberModifyBitChanges(uMsr, &fIgnMask, &fGpMask, 0x7);
3496 return printMsrFunctionCpumCpuEx(uMsr, NULL, NULL, NULL, fIgnMask, fGpMask, NULL);
3511 uint32_t uMsr = paMsrs[0].uMsr;
3517 && ( paMsrs[cDetectedRegs].uMsr == uMsr + cRegs
3522 if (paMsrs[cDetectedRegs].uMsr == uMsr + cRegs)
3533 return printMsrRangeFunction(uMsr, uMsr + cRegs - 1, "Ia32McCtlStatusAddrMiscN", NULL, NULL);
3552 && paMsrs[cRegs].uMsr <= 0x8ff)
3565 * @param uMsr The MSR number.
3568 static int reportMsr_Amd64Efer(uint32_t uMsr, uint64_t uValue)
3591 return reportMsr_GenFunctionEx(uMsr, NULL, uValue, fSkipMask, MSR_K6_EFER_LMA, NULL);
3610 && paMsrs[cRegs].uMsr == paMsrs[0].uMsr + cRegs)
3621 int rc = msrProberModifyBitChanges(paMsrs[cUsed].uMsr, &fIgnMaskN, &fGpMaskN, 0);
3633 return RTMsgErrorRc(VERR_NOT_EQUAL, "AmdFam16hMc4MiscN mismatch: fIgn=%#llx/%#llx fGp=%#llx/%#llx uMsr=%#x\n",
3634 fIgnMaskN, fIgnMask, fGpMaskN, fGpMask, paMsrs[cUsed].uMsr);
3638 printMsrRangeFunctionEx(paMsrs[0].uMsr, paMsrs[cUsed - 1].uMsr, "AmdFam10hMc4MiscN", NULL, 0, fIgnMask, fGpMask, NULL);
3645 int rc = msrProberModifyBitChanges(paMsrs[cUsed + cReserved].uMsr, &fIgnMask, &fGpMask, 0);
3650 "Unexpected reserved AmdFam16hMc4MiscN: fIgn=%#llx fGp=%#llx uMsr=%#x uValue=%#llx\n",
3651 fIgnMask, fGpMask, paMsrs[cUsed + cReserved].uMsr, paMsrs[cUsed + cReserved].uValue);
3655 printMsrRangeValueIgnoreWrites(paMsrs[cUsed].uMsr, paMsrs[cUsed + cReserved - 1].uMsr, 0, NULL);
3657 printMsrRangeValueReadOnly(paMsrs[cUsed].uMsr, paMsrs[cUsed + cReserved - 1].uMsr, 0, NULL);
3675 uint32_t uMsr = paMsrs[0].uMsr;
3676 Assert(uMsr == 0xc0010000);
3682 printMsrAlias(uMsr + i, 0xc0010200 + i * 2, NULL);
3702 uint32_t uMsr = paMsrs[0].uMsr;
3703 Assert(uMsr == 0xc0010004);
3709 printMsrAlias(uMsr + i, 0xc0010201 + i * 2, NULL);
3722 * @param uMsr The MSR number.
3725 static int reportMsr_AmdK8SysCfg(uint32_t uMsr, uint64_t uValue)
3769 return reportMsr_GenFunctionEx(uMsr, NULL, uValue, fSkipMask, 0, annotateValue(uValue));
3777 * @param uMsr The MSR number.
3780 static int reportMsr_AmdK8HwCr(uint32_t uMsr, uint64_t uValue)
3801 return reportMsr_GenFunctionEx(uMsr, NULL, uValue, fSkipMask, 0, annotateValue(uValue));
3809 * @param uMsr The MSR number.
3812 static int reportMsr_AmdK8IorrBaseN(uint32_t uMsr, uint64_t uValue)
3817 return reportMsr_GenFunctionEx(uMsr, NULL, (uMsr - 0xc0010016) / 2, fSkipMask, 0, annotateValue(uValue));
3825 * @param uMsr The MSR number.
3828 static int reportMsr_AmdK8IorrMaskN(uint32_t uMsr, uint64_t uValue)
3833 return reportMsr_GenFunctionEx(uMsr, NULL, (uMsr - 0xc0010017) / 2, fSkipMask, 0, annotateValue(uValue));
3841 * @param uMsr The MSR number.
3844 static int reportMsr_AmdK8TopMemN(uint32_t uMsr, uint64_t uValue)
3848 return reportMsr_GenFunctionEx(uMsr, NULL, uMsr == 0xc001001d, fSkipMask, 0, annotateValue(uValue));
3863 uint32_t uMsr = paMsrs[0].uMsr;
3864 AssertRelease(uMsr == 0xc0010064);
3870 && paMsrs[cRegs].uMsr == uMsr + cRegs)
3895 int rc = msrProberModifyBitChanges(uMsr + i, &fIgnMask, &fGpMask, fSkipMask);
3898 printMsrFunctionExtended(uMsr + i, "AmdFam10hPStateN", NULL, paMsrs[i].uValue, fIgnMask, fGpMask,
3912 * @param uMsr The MSR number.
3915 static int reportMsr_AmdFam10hCofVidControl(uint32_t uMsr, uint64_t uValue)
3933 return reportMsr_GenFunctionEx(uMsr, NULL, uValue, fSkipMask, 0, annotateValue(uValue));
3953 uint32_t uMsr = paMsrs[0].uMsr;
3959 && paMsrs[cRegs].uMsr == uMsr + cRegs)
3962 return RTMsgErrorRc(VERR_INVALID_PARAMETER, "PERF range at %#x is odd: cRegs=%#x\n", uMsr, cRegs);
3969 int rc = msrProberModifyBitChanges(uMsr + i, &fIgnMask, &fGpMask, 0);
3972 printMsrFunctionExtendedIdxVal(uMsr + i, NULL, NULL, i / 2, fIgnMask, fGpMask, annotateValue(paMsrs[i].uValue));
3985 * @param uMsr The MSR number.
3988 static int reportMsr_AmdK7InstrCacheCfg(uint32_t uMsr, uint64_t uValue)
4003 return reportMsr_GenFunctionEx(uMsr, NULL, uValue, fSkipMask, 0, annotateValue(uValue));
4011 * @param uMsr The MSR number.
4014 static int reportMsr_AmdFam15hCombUnitCfg(uint32_t uMsr, uint64_t uValue)
4024 return reportMsr_GenFunctionEx(uMsr, NULL, uValue, fSkipMask, 0, annotateValue(uValue));
4032 * @param uMsr The MSR number.
4035 static int reportMsr_AmdFam15hExecUnitCfg(uint32_t uMsr, uint64_t uValue)
4040 return reportMsr_GenFunctionEx(uMsr, NULL, uValue, fSkipMask, 0, annotateValue(uValue));
4052 uint32_t uMsr = paMsrs[i].uMsr;
4057 //if (uMsr < 0x00000000)
4059 if (uMsr >= 0x00000277)
4061 vbCpuRepDebug("produceMsrReport: uMsr=%#x (%s)...\n", uMsr, getMsrNameHandled(uMsr));
4070 if (uMsr == 0x00000079)
4071 rc = printMsrWriteOnly(uMsr, NULL, NULL);
4073 rc = reportMsr_Generic(uMsr, fFlags, uValue);
4079 else if (isMsrViaDummy(uMsr, uValue, fFlags))
4082 * This shall be sorted by uMsr as much as possible.
4084 else if (uMsr == 0x00000000 && g_enmVendor == CPUMCPUVENDOR_AMD && g_enmMicroarch >= kCpumMicroarch_AMD_K8_First)
4085 rc = printMsrAlias(uMsr, 0x00000402, NULL);
4086 else if (uMsr == 0x00000001 && g_enmVendor == CPUMCPUVENDOR_AMD && g_enmMicroarch >= kCpumMicroarch_AMD_K8_First)
4087 rc = printMsrAlias(uMsr, 0x00000401, NULL); /** @todo not 101% correct on Fam15h and later, 0xc0010015[McstatusWrEn] effect differs. */
4088 else if (uMsr == 0x0000001b)
4089 rc = reportMsr_Ia32ApicBase(uMsr, uValue);
4090 else if (uMsr == 0x00000040 && g_enmMicroarch <= kCpumMicroarch_Intel_P6_M_Dothan)
4092 else if (uMsr == 0x00000040)
4093 rc = reportMsr_GenRangeFunctionEx(&paMsrs[i], cMsrs - i, 8 /*cMax*/, "IntelLastBranchToN", uMsr, false,
4094 true, getGenericSkipMask(uMsr), &i);
4095 else if (uMsr == 0x00000060 && g_enmMicroarch >= kCpumMicroarch_Intel_Core_Yonah)
4096 rc = reportMsr_GenRangeFunctionEx(&paMsrs[i], cMsrs - i, 8 /*cMax*/, "IntelLastBranchFromN", uMsr, false,
4097 true, getGenericSkipMask(uMsr), &i);
4098 else if (uMsr == 0x000000c1)
4102 else if (uMsr == 0x00000186 && !g_fIntelNetBurst)
4104 else if (uMsr == 0x000001a0)
4105 rc = reportMsr_Ia32MiscEnable(uMsr, uValue);
4106 else if (uMsr >= 0x000001a6 && uMsr <= 0x000001a7)
4108 else if (uMsr == 0x000001db && g_fIntelNetBurst)
4110 else if (uMsr == 0x00000200)
4112 else if (uMsr >= 0x00000250 && uMsr <= 0x00000279)
4113 rc = reportMsr_Ia32MtrrFixedOrPat(uMsr);
4114 else if (uMsr >= 0x00000280 && uMsr <= 0x00000295)
4116 else if (uMsr == 0x000002ff)
4117 rc = reportMsr_Ia32MtrrDefType(uMsr);
4118 else if (uMsr >= 0x00000309 && uMsr <= 0x0000030b && !g_fIntelNetBurst)
4120 else if ((uMsr == 0x000003f8 || uMsr == 0x000003fc || uMsr == 0x0000060a) && !g_fIntelNetBurst)
4121 rc = reportMsr_GenRangeFunctionEx(&paMsrs[i], cMsrs - i, 4, NULL, uMsr - 3, true, false, 0, &i);
4122 else if ((uMsr == 0x000003f9 || uMsr == 0x000003fd || uMsr == 0x0000060b) && !g_fIntelNetBurst)
4123 rc = reportMsr_GenRangeFunctionEx(&paMsrs[i], cMsrs - i, 8, NULL, uMsr - 6, true, false, 0, &i);
4124 else if ((uMsr == 0x000003fa || uMsr == 0x000003fe || uMsr == 0x0000060c) && !g_fIntelNetBurst)
4125 rc = reportMsr_GenRangeFunctionEx(&paMsrs[i], cMsrs - i, 8, NULL, uMsr - 7, true, false, 0, &i);
4126 else if (uMsr >= 0x00000400 && uMsr <= 0x00000477)
4128 else if (uMsr == 0x000004c1)
4130 else if (uMsr == 0x00000680 || uMsr == 0x000006c0)
4131 rc = reportMsr_GenRangeFunctionEx(&paMsrs[i], cMsrs - i, 16, NULL, uMsr, false, false,
4135 else if (uMsr >= 0x00000800 && uMsr <= 0x000008ff)
4137 else if (uMsr == 0x00002000 && g_enmVendor == CPUMCPUVENDOR_INTEL)
4138 rc = reportMsr_GenFunctionEx(uMsr, "IntelP6CrN", 0, X86_CR0_PE | X86_CR0_PG, 0,
4140 else if (uMsr == 0x00002002 && g_enmVendor == CPUMCPUVENDOR_INTEL)
4141 rc = reportMsr_GenFunctionEx(uMsr, "IntelP6CrN", 2, 0, 0, annotateValue(uValue));
4142 else if (uMsr == 0x00002003 && g_enmVendor == CPUMCPUVENDOR_INTEL)
4147 rc = reportMsr_GenFunctionEx(uMsr, "IntelP6CrN", 3, fCr3Mask, 0, annotateValue(uValue));
4149 else if (uMsr == 0x00002004 && g_enmVendor == CPUMCPUVENDOR_INTEL)
4150 rc = reportMsr_GenFunctionEx(uMsr, "IntelP6CrN", 4,
4153 else if (uMsr == 0xc0000080)
4154 rc = reportMsr_Amd64Efer(uMsr, uValue);
4155 else if (uMsr >= 0xc0000408 && uMsr <= 0xc000040f)
4157 else if (uMsr == 0xc0010000 && g_enmVendor == CPUMCPUVENDOR_AMD)
4159 else if (uMsr == 0xc0010004 && g_enmVendor == CPUMCPUVENDOR_AMD)
4161 else if (uMsr == 0xc0010010 && g_enmVendor == CPUMCPUVENDOR_AMD)
4162 rc = reportMsr_AmdK8SysCfg(uMsr, uValue);
4163 else if (uMsr == 0xc0010015 && g_enmVendor == CPUMCPUVENDOR_AMD)
4164 rc = reportMsr_AmdK8HwCr(uMsr, uValue);
4165 else if ((uMsr == 0xc0010016 || uMsr == 0xc0010018) && g_enmVendor == CPUMCPUVENDOR_AMD)
4166 rc = reportMsr_AmdK8IorrBaseN(uMsr, uValue);
4167 else if ((uMsr == 0xc0010017 || uMsr == 0xc0010019) && g_enmVendor == CPUMCPUVENDOR_AMD)
4168 rc = reportMsr_AmdK8IorrMaskN(uMsr, uValue);
4169 else if ((uMsr == 0xc001001a || uMsr == 0xc001001d) && g_enmVendor == CPUMCPUVENDOR_AMD)
4170 rc = reportMsr_AmdK8TopMemN(uMsr, uValue);
4171 else if (uMsr == 0xc0010030 && g_enmVendor == CPUMCPUVENDOR_AMD)
4173 else if (uMsr >= 0xc0010044 && uMsr <= 0xc001004a && g_enmVendor == CPUMCPUVENDOR_AMD)
4175 else if (uMsr == 0xc0010050 && g_enmVendor == CPUMCPUVENDOR_AMD)
4177 else if (uMsr == 0xc0010064 && g_enmVendor == CPUMCPUVENDOR_AMD)
4179 else if (uMsr == 0xc0010070 && g_enmVendor == CPUMCPUVENDOR_AMD)
4180 rc = reportMsr_AmdFam10hCofVidControl(uMsr, uValue);
4181 else if ((uMsr == 0xc0010118 || uMsr == 0xc0010119) && getMsrFnName(uMsr, NULL) && g_enmVendor == CPUMCPUVENDOR_AMD)
4182 rc = printMsrFunction(uMsr, NULL, NULL, annotateValue(uValue)); /* RAZ, write key. */
4183 else if (uMsr == 0xc0010200 && g_enmVendor == CPUMCPUVENDOR_AMD)
4185 else if (uMsr == 0xc0010230 && g_enmVendor == CPUMCPUVENDOR_AMD)
4187 else if (uMsr == 0xc0010240 && g_enmVendor == CPUMCPUVENDOR_AMD)
4189 else if (uMsr == 0xc0011019 && g_enmMicroarch >= kCpumMicroarch_AMD_15h_Piledriver && g_enmVendor == CPUMCPUVENDOR_AMD)
4192 else if (uMsr == 0xc0011021 && g_enmVendor == CPUMCPUVENDOR_AMD)
4193 rc = reportMsr_AmdK7InstrCacheCfg(uMsr, uValue);
4194 else if (uMsr == 0xc0011023 && CPUMMICROARCH_IS_AMD_FAM_15H(g_enmMicroarch))
4195 rc = reportMsr_AmdFam15hCombUnitCfg(uMsr, uValue);
4196 else if (uMsr == 0xc0011027 && g_enmVendor == CPUMCPUVENDOR_AMD)
4199 else if (uMsr == 0xc001102c && CPUMMICROARCH_IS_AMD_FAM_15H(g_enmMicroarch))
4200 rc = reportMsr_AmdFam15hExecUnitCfg(uMsr, uValue);
4203 rc = reportMsr_Generic(uMsr, fFlags, uValue);
4211 if (uMsr == 0x000000cd && !(fFlags & VBCPUREPMSR_F_WRITE_ONLY))
4231 uint32_t uMsr = 0xc0000081;
4232 vbCpuRepDebug("%#x: msrProberModifyNoChange -> %RTbool\n", uMsr, msrProberModifyNoChange(uMsr));
4235 vbCpuRepDebug("%#x: msrProberModifyBit 30 -> %d\n", uMsr, msrProberModifyBit(uMsr, 30));
4238 vbCpuRepDebug("%#x: msrProberModifyZero -> %RTbool\n", uMsr, msrProberModifyZero(uMsr));
4243 vbCpuRepDebug("%#x: bit=%02u -> %d\n", msrProberModifyBit(uMsr, i));
4248 uint32_t uMsr = 0xc0010010;
4250 msrProberRead(uMsr, &uValue);
4251 reportMsr_AmdK8SysCfg(uMsr, uValue);