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