]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/X64/WriteMsr64.c
bb030832c497c7358078eec4a28952803754201e
[mirror_edk2.git] / MdePkg / Library / BaseLib / X64 / WriteMsr64.c
1 /** @file
2 CpuBreakpoint function.
3
4 Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 /**
10 Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.
11 **/
12
13 #include <Library/RegisterFilterLib.h>
14
15 void __writemsr (unsigned long Register, unsigned __int64 Value);
16
17 #pragma intrinsic(__writemsr)
18
19 /**
20 Write data to MSR.
21
22 @param Index The register index of MSR.
23 @param Value Data wants to be written.
24
25 @return Value written to MSR.
26
27 **/
28 UINT64
29 EFIAPI
30 AsmWriteMsr64 (
31 IN UINT32 Index,
32 IN UINT64 Value
33 )
34 {
35 BOOLEAN Flag;
36
37 Flag = FilterBeforeMsrWrite (Index, &Value);
38 if (Flag) {
39 __writemsr (Index, Value);
40 }
41 FilterAfterMsrWrite (Index, &Value);
42
43 return Value;
44 }
45