]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/WriteMsr64.c
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / WriteMsr64.c
1 /** @file
2 AsmWriteMsr64 function
3
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9
10
11
12 /**
13 Writes a 64-bit value to a Machine Specific Register(MSR), and returns the
14 value.
15
16 Writes the 64-bit value specified by Value to the MSR specified by Index. The
17 64-bit value written to the MSR is returned. No parameter checking is
18 performed on Index or Value, and some of these may cause CPU exceptions. The
19 caller must either guarantee that Index and Value are valid, or the caller
20 must establish proper exception handlers. This function is only available on
21 IA-32 and x64.
22
23 @param Index The 32-bit MSR index to write.
24 @param Value The 64-bit value to write to the MSR.
25
26 @return Value
27
28 **/
29 UINT64
30 EFIAPI
31 AsmWriteMsr64 (
32 IN UINT32 Index,
33 IN UINT64 Value
34 )
35 {
36 _asm {
37 mov edx, dword ptr [Value + 4]
38 mov eax, dword ptr [Value + 0]
39 mov ecx, Index
40 wrmsr
41 }
42 }
43