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