1/// @file
2///  IPF specific Machine Specific Registers accessing functions.
3///  This implementation uses raw data to prepresent the assembly instruction of
4/// mov msr[]= and mov =msr[].
5///
6/// Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
7/// This program and the accompanying materials
8/// are licensed and made available under the terms and conditions of the BSD License
9/// which accompanies this distribution.  The full text of the license may be found at
10/// http://opensource.org/licenses/bsd-license.php.
11///
12/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14///
15///
16///
17
18
19//---------------------------------------------------------------------------------
20//++
21// AsmReadMsr
22//
23// Reads the current value of a Machine Specific Register (MSR).
24//
25// Reads and returns the current value of the Machine Specific Register specified by Index.  No
26// parameter checking is performed on Index, and if the Index value is beyond the implemented MSR
27// register range, a Reserved Register/Field fault may occur.  The caller must either guarantee that
28// Index is valid, or the caller must set up fault handlers to catch the faults.  This function is
29// only available on IPF.
30//
31// Arguments :
32//
33// On Entry : The 8-bit Machine Specific Register index to read.
34//
35// Return Value: The current value of the Machine Specific Register specified by Index.
36//
37//--
38//----------------------------------------------------------------------------------
39.text
40.type   AsmReadMsr, @function
41.proc   AsmReadMsr
42.regstk 1, 0, 0, 0
43
44AsmReadMsr::
45//
46// The follow 16 bytes stand for the bundle of
47//   mov    r8=msr[in0];;
48// since MSFT tool chain does not support mov =msr[] instruction
49//
50  data1 0x0D
51  data1 0x40
52  data1 0x00
53  data1 0x40
54  data1 0x16
55  data1 0x04
56  data1 0x00
57  data1 0x00
58  data1 0x00
59  data1 0x02
60  data1 0x00
61  data1 0x00
62  data1 0x00
63  data1 0x00
64  data1 0x04
65  data1 0x00
66  br.ret.sptk  b0;;
67.endp   AsmReadMsr
68
69//---------------------------------------------------------------------------------
70//++
71// AsmWriteMsr
72//
73// Writes the current value of a Machine Specific Register (MSR).
74//
75// Writes Value to the Machine Specific Register specified by Index.  Value is returned.  No
76// parameter checking is performed on Index, and if the Index value is beyond the implemented MSR
77// register range, a Reserved Register/Field fault may occur.  The caller must either guarantee that
78// Index is valid, or the caller must set up fault handlers to catch the faults.  This function is
79// only available on IPF.
80//
81// Arguments :
82//
83// On Entry : The 8-bit Machine Specific Register index to write.
84//            The 64-bit value to write to the Machine Specific Register.
85//
86// Return Value: The 64-bit value to write to the Machine Specific Register.
87//
88//--
89//----------------------------------------------------------------------------------
90.text
91.type   AsmWriteMsr, @function
92.proc   AsmWriteMsr
93.regstk 2, 0, 0, 0
94
95AsmWriteMsr::
96//
97// The follow 16 bytes stand for the bundle of
98//  mov             msr[in0] = in1
99//  mov             r8 = in1;;
100// since MSFT tool chain does not support mov msr[]= instruction
101//
102  data1 0x0D
103  data1 0x00
104  data1 0x84
105  data1 0x40
106  data1 0x06
107  data1 0x04
108  data1 0x00
109  data1 0x00
110  data1 0x00
111  data1 0x02
112  data1 0x00
113  data1 0x00
114  data1 0x01
115  data1 0x08
116  data1 0x01
117  data1 0x84
118  srlz.d;;
119  br.ret.sptk     b0;;
120.endp   AsmWriteMsr
121
122