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