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 33namespace X86ISA 34{ 35 |
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 |
146const MsrMap msrMap(msrMapData, msrMapData + msrMapSize); |
147 148bool 149msrAddrToIndex(MiscRegIndex ®Num, Addr addr) 150{ |
151 MsrMap::const_iterator it(msrMap.find(addr)); |
152 if (it == msrMap.end()) { 153 return false; 154 } else { 155 regNum = it->second; 156 return true; 157 } 158} 159 160} // namespace X86ISA |