summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/BaseLib/X64/ReadMsr64.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdePkg/Library/BaseLib/X64/ReadMsr64.c')
-rw-r--r--MdePkg/Library/BaseLib/X64/ReadMsr64.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/MdePkg/Library/BaseLib/X64/ReadMsr64.c b/MdePkg/Library/BaseLib/X64/ReadMsr64.c
index 5ee7ca53f3..36a349432c 100644
--- a/MdePkg/Library/BaseLib/X64/ReadMsr64.c
+++ b/MdePkg/Library/BaseLib/X64/ReadMsr64.c
@@ -1,7 +1,7 @@
/** @file
CpuBreakpoint function.
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -10,6 +10,8 @@
Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.
**/
+#include <Library/RegisterFilterLib.h>
+
unsigned __int64 __readmsr (int register);
#pragma intrinsic(__readmsr)
@@ -28,6 +30,15 @@ AsmReadMsr64 (
IN UINT32 Index
)
{
- return __readmsr (Index);
+ UINT64 Value;
+ BOOLEAN Flag;
+
+ Flag = FilterBeforeMsrRead (Index, &Value);
+ if (Flag) {
+ Value = __readmsr (Index);
+ }
+ FilterAfterMsrRead (Index, &Value);
+
+ return Value;
}