1/// @file
2///  IPF specific Machine Specific Registers accessing functions.
3///
4/// Copyright (c) 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// AsmReadMsr
20//
21// Reads the current value of a Machine Specific Register (MSR).
22//
23// Reads and returns the current value of the Machine Specific Register specified by Index.  No
24// parameter checking is performed on Index, and if the Index value is beyond the implemented MSR
25// register range, a Reserved Register/Field fault may occur.  The caller must either guarantee that
26// Index is valid, or the caller must set up fault handlers to catch the faults.  This function is
27// only available on IPF.
28//
29// Arguments :
30//
31// On Entry : The 8-bit Machine Specific Register index to read.
32//
33// Return Value: The current value of the Machine Specific Register specified by Index.
34//
35//--
36//----------------------------------------------------------------------------------
37.text
38.type   AsmReadMsr, @function
39.proc   AsmReadMsr
40.regstk 1, 0, 0, 0
41
42AsmReadMsr::
43  mov    r8=msr[in0];;
44  br.ret.sptk  b0;;
45.endp   AsmReadMsr
46
47//---------------------------------------------------------------------------------
48//++
49// AsmWriteMsr
50//
51// Writes the current value of a Machine Specific Register (MSR).
52//
53// Writes Value to the Machine Specific Register specified by Index.  Value is returned.  No
54// parameter checking is performed on Index, and if the Index value is beyond the implemented MSR
55// register range, a Reserved Register/Field fault may occur.  The caller must either guarantee that
56// Index is valid, or the caller must set up fault handlers to catch the faults.  This function is
57// only available on IPF.
58//
59// Arguments :
60//
61// On Entry : The 8-bit Machine Specific Register index to write.
62//            The 64-bit value to write to the Machine Specific Register.
63//
64// Return Value: The 64-bit value to write to the Machine Specific Register.
65//
66//--
67//----------------------------------------------------------------------------------
68.text
69.type   AsmWriteMsr, @function
70.proc   AsmWriteMsr
71.regstk 2, 0, 0, 0
72
73AsmWriteMsr::
74  mov             msr[in0] = in1
75  mov             r8 = in1;;
76  srlz.d;;
77  br.ret.sptk     b0;;
78.endp   AsmWriteMsr
79
80