Deleted Added
sdiff udiff text old ( 8582:dd79a696b91c ) new ( 9875:5cfad3486991 )
full compact
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
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
149static MsrMap msrMap(msrMapData, msrMapData + msrMapSize);
150
151bool
152msrAddrToIndex(MiscRegIndex &regNum, Addr addr)
153{
154 MsrMap::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