/** @file\r
AsmReadMsr64 function\r
\r
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
\r
-\r
+#include <Library/RegisterFilterLib.h>\r
\r
/**\r
Returns a 64-bit Machine Specific Register(MSR).\r
\r
**/\r
UINT64\r
-EFIAPI\r
-AsmReadMsr64 (\r
+AsmReadMsr64Internal (\r
IN UINT32 Index\r
)\r
{\r
}\r
}\r
\r
+/**\r
+ Returns a 64-bit Machine Specific Register(MSR).\r
+\r
+ Reads and returns the 64-bit MSR specified by Index. No parameter checking is\r
+ performed on Index, and some Index values may cause CPU exceptions. The\r
+ caller must either guarantee that Index is valid, or the caller must set up\r
+ exception handlers to catch the exceptions. This function is only available\r
+ on IA-32 and x64.\r
+\r
+ @param Index The 32-bit MSR index to read.\r
+\r
+ @return The value of the MSR identified by Index.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+AsmReadMsr64 (\r
+ IN UINT32 Index\r
+ )\r
+{\r
+ UINT64 Value;\r
+ BOOLEAN Flag;\r
+\r
+ Flag = FilterBeforeMsrRead (Index, &Value);\r
+ if (Flag) {\r
+ Value = AsmReadMsr64Internal (Index);\r
+ }\r
+ FilterAfterMsrRead (Index, &Value);\r
+\r
+ return Value;\r
+}\r