]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | AsmWriteMsr64 function\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | \r | |
16 | \r | |
17 | \r | |
18 | /**\r | |
19 | Writes a 64-bit value to a Machine Specific Register(MSR), and returns the\r | |
20 | value.\r | |
21 | \r | |
22 | Writes the 64-bit value specified by Value to the MSR specified by Index. The\r | |
23 | 64-bit value written to the MSR is returned. No parameter checking is\r | |
24 | performed on Index or Value, and some of these may cause CPU exceptions. The\r | |
25 | caller must either guarantee that Index and Value are valid, or the caller\r | |
26 | must establish proper exception handlers. This function is only available on\r | |
27 | IA-32 and x64.\r | |
28 | \r | |
29 | @param Index The 32-bit MSR index to write.\r | |
30 | @param Value The 64-bit value to write to the MSR.\r | |
31 | \r | |
32 | @return Value\r | |
33 | \r | |
34 | **/\r | |
35 | UINT64\r | |
36 | EFIAPI\r | |
37 | AsmWriteMsr64 (\r | |
38 | IN UINT32 Index,\r | |
39 | IN UINT64 Value\r | |
40 | )\r | |
41 | {\r | |
42 | _asm {\r | |
43 | mov edx, dword ptr [Value + 4]\r | |
44 | mov eax, dword ptr [Value + 0]\r | |
45 | mov ecx, Index\r | |
46 | wrmsr\r | |
47 | }\r | |
48 | }\r | |
49 | \r |