Pyrogenesis  trunk
msr.h
Go to the documentation of this file.
1 /* Copyright (c) 2010 Wildfire Games
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining
4  * a copy of this software and associated documentation files (the
5  * "Software"), to deal in the Software without restriction, including
6  * without limitation the rights to use, copy, modify, merge, publish,
7  * distribute, sublicense, and/or sell copies of the Software, and to
8  * permit persons to whom the Software is furnished to do so, subject to
9  * the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
23 /*
24  * model-specific registers
25  */
26 
27 #ifndef INCLUDED_X86_X64_MSR
28 #define INCLUDED_X86_X64_MSR
29 
30 namespace MSR {
31 
33 {
34  // architectural (will not change on future processors)
36  IA32_ENERGY_PERF_BIAS = 0x1B0, // requires HasEnergyPerfBias
37 
38  // PMU v1
39  IA32_PMC0 = 0x0C1,
41 
42  // PMU v2
46 
47  // Nehalem and later
48  PLATFORM_INFO = 0x0CE, // requires HasPlatformInfo
49 
50  // Nehalem, Westmere (requires HasUncore)
54  UNCORE_PMC0 = 0x3B0,
56 };
57 
58 LIB_API bool IsAccessible();
59 
60 LIB_API bool HasEnergyPerfBias();
61 LIB_API bool HasPlatformInfo();
62 LIB_API bool HasUncore();
63 
64 LIB_API u64 Read(u64 reg);
65 LIB_API void Write(u64 reg, u64 value);
66 
67 } // namespace MSR
68 
69 #endif // #ifndef INCLUDED_X86_X64_MSR
Definition: msr.h:40
Definition: msr.h:44
bool HasUncore()
Definition: msr.cpp:103
bool IsAccessible()
Definition: msr.cpp:32
uint64_t u64
Definition: types.h:40
Definition: msr.h:55
Definition: msr.h:35
Definition: msr.h:43
Definition: msr.h:36
ModelSpecificRegisters
Definition: msr.h:32
Definition: msr.h:54
Definition: msr.h:52
Definition: msr.h:51
bool HasPlatformInfo()
Definition: msr.cpp:66
Definition: msr.cpp:30
bool HasEnergyPerfBias()
Definition: msr.cpp:45
Definition: msr.h:48
u64 Read(u64 reg)
Definition: msr.cpp:130
void Write(u64 reg, u64 value)
Definition: msr.cpp:136
Definition: msr.h:39
Definition: msr.h:45