msr.cc (8582:dd79a696b91c) msr.cc (9875:5cfad3486991)
1/*
2 * Copyright (c) 2011 Google
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 15 unchanged lines hidden (view full) ---

24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Gabe Black
29 */
30
31#include "arch/x86/regs/msr.hh"
1/*
2 * Copyright (c) 2011 Google
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 15 unchanged lines hidden (view full) ---

24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Gabe Black
29 */
30
31#include "arch/x86/regs/msr.hh"
32#include "base/hashmap.hh"
33
34namespace X86ISA
35{
36
32
33namespace X86ISA
34{
35
37typedef m5::hash_map<Addr, MiscRegIndex> MsrMap;
38
39typedef MsrMap::value_type MsrVal;
40
41const MsrMap::value_type msrMapData[] = {
42 MsrVal(0x10, MISCREG_TSC),
43 MsrVal(0x1B, MISCREG_APIC_BASE),
44 MsrVal(0xFE, MISCREG_MTRRCAP),
45 MsrVal(0x174, MISCREG_SYSENTER_CS),
46 MsrVal(0x175, MISCREG_SYSENTER_ESP),

--- 94 unchanged lines hidden (view full) ---

141 MsrVal(0xC0010114, MISCREG_VM_CR),
142 MsrVal(0xC0010115, MISCREG_IGNNE),
143 MsrVal(0xC0010116, MISCREG_SMM_CTL),
144 MsrVal(0xC0010117, MISCREG_VM_HSAVE_PA)
145};
146
147static const unsigned msrMapSize = sizeof(msrMapData) / sizeof(msrMapData[0]);
148
36typedef MsrMap::value_type MsrVal;
37
38const MsrMap::value_type msrMapData[] = {
39 MsrVal(0x10, MISCREG_TSC),
40 MsrVal(0x1B, MISCREG_APIC_BASE),
41 MsrVal(0xFE, MISCREG_MTRRCAP),
42 MsrVal(0x174, MISCREG_SYSENTER_CS),
43 MsrVal(0x175, MISCREG_SYSENTER_ESP),

--- 94 unchanged lines hidden (view full) ---

138 MsrVal(0xC0010114, MISCREG_VM_CR),
139 MsrVal(0xC0010115, MISCREG_IGNNE),
140 MsrVal(0xC0010116, MISCREG_SMM_CTL),
141 MsrVal(0xC0010117, MISCREG_VM_HSAVE_PA)
142};
143
144static const unsigned msrMapSize = sizeof(msrMapData) / sizeof(msrMapData[0]);
145
149static MsrMap msrMap(msrMapData, msrMapData + msrMapSize);
146const MsrMap msrMap(msrMapData, msrMapData + msrMapSize);
150
151bool
152msrAddrToIndex(MiscRegIndex &regNum, Addr addr)
153{
147
148bool
149msrAddrToIndex(MiscRegIndex &regNum, Addr addr)
150{
154 MsrMap::iterator it = msrMap.find(addr);
151 MsrMap::const_iterator it(msrMap.find(addr));
155 if (it == msrMap.end()) {
156 return false;
157 } else {
158 regNum = it->second;
159 return true;
160 }
161}
162
163} // namespace X86ISA
152 if (it == msrMap.end()) {
153 return false;
154 } else {
155 regNum = it->second;
156 return true;
157 }
158}
159
160} // namespace X86ISA