isa.cc revision 10844
16313Sgblack@eecs.umich.edu/* 26313Sgblack@eecs.umich.edu * Copyright (c) 2009 The Regents of The University of Michigan 36313Sgblack@eecs.umich.edu * All rights reserved. 46313Sgblack@eecs.umich.edu * 56313Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 66313Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are 76313Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright 86313Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 96313Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 106313Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 116313Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution; 126313Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its 136313Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 146313Sgblack@eecs.umich.edu * this software without specific prior written permission. 156313Sgblack@eecs.umich.edu * 166313Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 176313Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 186313Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 196313Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 206313Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 216313Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 226313Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 236313Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 246313Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 256313Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 266313Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 276313Sgblack@eecs.umich.edu * 286313Sgblack@eecs.umich.edu * Authors: Gabe Black 296313Sgblack@eecs.umich.edu */ 306313Sgblack@eecs.umich.edu 319376Sgblack@eecs.umich.edu#include "arch/x86/decoder.hh" 326313Sgblack@eecs.umich.edu#include "arch/x86/isa.hh" 336336Sgblack@eecs.umich.edu#include "arch/x86/tlb.hh" 346336Sgblack@eecs.umich.edu#include "cpu/base.hh" 356313Sgblack@eecs.umich.edu#include "cpu/thread_context.hh" 369384SAndreas.Sandberg@arm.com#include "params/X86ISA.hh" 376336Sgblack@eecs.umich.edu#include "sim/serialize.hh" 386313Sgblack@eecs.umich.edu 396313Sgblack@eecs.umich.edunamespace X86ISA 406313Sgblack@eecs.umich.edu{ 416313Sgblack@eecs.umich.edu 426313Sgblack@eecs.umich.eduvoid 436336Sgblack@eecs.umich.eduISA::updateHandyM5Reg(Efer efer, CR0 cr0, 449376Sgblack@eecs.umich.edu SegAttr csAttr, SegAttr ssAttr, RFLAGS rflags, 459376Sgblack@eecs.umich.edu ThreadContext *tc) 466336Sgblack@eecs.umich.edu{ 476712Snate@binkert.org HandyM5Reg m5reg = 0; 486336Sgblack@eecs.umich.edu if (efer.lma) { 496336Sgblack@eecs.umich.edu m5reg.mode = LongMode; 506336Sgblack@eecs.umich.edu if (csAttr.longMode) 516336Sgblack@eecs.umich.edu m5reg.submode = SixtyFourBitMode; 526336Sgblack@eecs.umich.edu else 536336Sgblack@eecs.umich.edu m5reg.submode = CompatabilityMode; 546336Sgblack@eecs.umich.edu } else { 556336Sgblack@eecs.umich.edu m5reg.mode = LegacyMode; 566336Sgblack@eecs.umich.edu if (cr0.pe) { 576336Sgblack@eecs.umich.edu if (rflags.vm) 586336Sgblack@eecs.umich.edu m5reg.submode = Virtual8086Mode; 596336Sgblack@eecs.umich.edu else 606336Sgblack@eecs.umich.edu m5reg.submode = ProtectedMode; 616336Sgblack@eecs.umich.edu } else { 626336Sgblack@eecs.umich.edu m5reg.submode = RealMode; 636336Sgblack@eecs.umich.edu } 646336Sgblack@eecs.umich.edu } 656336Sgblack@eecs.umich.edu m5reg.cpl = csAttr.dpl; 666336Sgblack@eecs.umich.edu m5reg.paging = cr0.pg; 676336Sgblack@eecs.umich.edu m5reg.prot = cr0.pe; 686336Sgblack@eecs.umich.edu 696336Sgblack@eecs.umich.edu // Compute the default and alternate operand size. 706336Sgblack@eecs.umich.edu if (m5reg.submode == SixtyFourBitMode || csAttr.defaultSize) { 716336Sgblack@eecs.umich.edu m5reg.defOp = 2; 726336Sgblack@eecs.umich.edu m5reg.altOp = 1; 736336Sgblack@eecs.umich.edu } else { 746336Sgblack@eecs.umich.edu m5reg.defOp = 1; 756336Sgblack@eecs.umich.edu m5reg.altOp = 2; 766336Sgblack@eecs.umich.edu } 776336Sgblack@eecs.umich.edu 786336Sgblack@eecs.umich.edu // Compute the default and alternate address size. 796336Sgblack@eecs.umich.edu if (m5reg.submode == SixtyFourBitMode) { 806336Sgblack@eecs.umich.edu m5reg.defAddr = 3; 816336Sgblack@eecs.umich.edu m5reg.altAddr = 2; 826336Sgblack@eecs.umich.edu } else if (csAttr.defaultSize) { 836336Sgblack@eecs.umich.edu m5reg.defAddr = 2; 846336Sgblack@eecs.umich.edu m5reg.altAddr = 1; 856336Sgblack@eecs.umich.edu } else { 866336Sgblack@eecs.umich.edu m5reg.defAddr = 1; 876336Sgblack@eecs.umich.edu m5reg.altAddr = 2; 886336Sgblack@eecs.umich.edu } 896336Sgblack@eecs.umich.edu 906336Sgblack@eecs.umich.edu // Compute the stack size 916336Sgblack@eecs.umich.edu if (m5reg.submode == SixtyFourBitMode) { 926336Sgblack@eecs.umich.edu m5reg.stack = 3; 936336Sgblack@eecs.umich.edu } else if (ssAttr.defaultSize) { 946336Sgblack@eecs.umich.edu m5reg.stack = 2; 956336Sgblack@eecs.umich.edu } else { 966336Sgblack@eecs.umich.edu m5reg.stack = 1; 976336Sgblack@eecs.umich.edu } 986336Sgblack@eecs.umich.edu 996336Sgblack@eecs.umich.edu regVal[MISCREG_M5_REG] = m5reg; 1009376Sgblack@eecs.umich.edu if (tc) 1019376Sgblack@eecs.umich.edu tc->getDecoderPtr()->setM5Reg(m5reg); 1026336Sgblack@eecs.umich.edu} 1036336Sgblack@eecs.umich.edu 1046336Sgblack@eecs.umich.eduvoid 1056313Sgblack@eecs.umich.eduISA::clear() 1066313Sgblack@eecs.umich.edu{ 1076336Sgblack@eecs.umich.edu // Blank everything. 0 might not be an appropriate value for some things, 1086336Sgblack@eecs.umich.edu // but it is for most. 1096336Sgblack@eecs.umich.edu memset(regVal, 0, NumMiscRegs * sizeof(MiscReg)); 1106336Sgblack@eecs.umich.edu regVal[MISCREG_DR6] = (mask(8) << 4) | (mask(16) << 16); 1116336Sgblack@eecs.umich.edu regVal[MISCREG_DR7] = 1 << 10; 1126313Sgblack@eecs.umich.edu} 1136313Sgblack@eecs.umich.edu 1149384SAndreas.Sandberg@arm.comISA::ISA(Params *p) 1159384SAndreas.Sandberg@arm.com : SimObject(p) 1169384SAndreas.Sandberg@arm.com{ 1179384SAndreas.Sandberg@arm.com clear(); 1189384SAndreas.Sandberg@arm.com} 1199384SAndreas.Sandberg@arm.com 1209384SAndreas.Sandberg@arm.comconst X86ISAParams * 1219384SAndreas.Sandberg@arm.comISA::params() const 1229384SAndreas.Sandberg@arm.com{ 1239384SAndreas.Sandberg@arm.com return dynamic_cast<const Params *>(_params); 1249384SAndreas.Sandberg@arm.com} 1259384SAndreas.Sandberg@arm.com 1266313Sgblack@eecs.umich.eduMiscReg 12710698Sandreas.hansson@arm.comISA::readMiscRegNoEffect(int miscReg) const 1286313Sgblack@eecs.umich.edu{ 1296336Sgblack@eecs.umich.edu // Make sure we're not dealing with an illegal control register. 1306336Sgblack@eecs.umich.edu // Instructions should filter out these indexes, and nothing else should 1316336Sgblack@eecs.umich.edu // attempt to read them directly. 1326336Sgblack@eecs.umich.edu assert( miscReg != MISCREG_CR1 && 1336336Sgblack@eecs.umich.edu !(miscReg > MISCREG_CR4 && 1346336Sgblack@eecs.umich.edu miscReg < MISCREG_CR8) && 1356336Sgblack@eecs.umich.edu !(miscReg > MISCREG_CR8 && 1366336Sgblack@eecs.umich.edu miscReg <= MISCREG_CR15)); 1376336Sgblack@eecs.umich.edu 1386336Sgblack@eecs.umich.edu return regVal[miscReg]; 1396313Sgblack@eecs.umich.edu} 1406313Sgblack@eecs.umich.edu 1416313Sgblack@eecs.umich.eduMiscReg 1426336Sgblack@eecs.umich.eduISA::readMiscReg(int miscReg, ThreadContext * tc) 1436313Sgblack@eecs.umich.edu{ 1446336Sgblack@eecs.umich.edu if (miscReg == MISCREG_TSC) { 1456336Sgblack@eecs.umich.edu return regVal[MISCREG_TSC] + tc->getCpuPtr()->curCycle(); 1466336Sgblack@eecs.umich.edu } 1479372Snilay@cs.wisc.edu 1489372Snilay@cs.wisc.edu if (miscReg == MISCREG_FSW) { 1499372Snilay@cs.wisc.edu MiscReg fsw = regVal[MISCREG_FSW]; 1509372Snilay@cs.wisc.edu MiscReg top = regVal[MISCREG_X87_TOP]; 1519372Snilay@cs.wisc.edu return (fsw & (~(7ULL << 11))) + (top << 11); 1529372Snilay@cs.wisc.edu } 1539372Snilay@cs.wisc.edu 1546336Sgblack@eecs.umich.edu return readMiscRegNoEffect(miscReg); 1556313Sgblack@eecs.umich.edu} 1566313Sgblack@eecs.umich.edu 1576313Sgblack@eecs.umich.eduvoid 1586336Sgblack@eecs.umich.eduISA::setMiscRegNoEffect(int miscReg, MiscReg val) 1596313Sgblack@eecs.umich.edu{ 1606336Sgblack@eecs.umich.edu // Make sure we're not dealing with an illegal control register. 1616336Sgblack@eecs.umich.edu // Instructions should filter out these indexes, and nothing else should 1626336Sgblack@eecs.umich.edu // attempt to write to them directly. 1636336Sgblack@eecs.umich.edu assert( miscReg != MISCREG_CR1 && 1646336Sgblack@eecs.umich.edu !(miscReg > MISCREG_CR4 && 1656336Sgblack@eecs.umich.edu miscReg < MISCREG_CR8) && 1666336Sgblack@eecs.umich.edu !(miscReg > MISCREG_CR8 && 1676336Sgblack@eecs.umich.edu miscReg <= MISCREG_CR15)); 1686336Sgblack@eecs.umich.edu regVal[miscReg] = val; 1696313Sgblack@eecs.umich.edu} 1706313Sgblack@eecs.umich.edu 1716313Sgblack@eecs.umich.eduvoid 1726336Sgblack@eecs.umich.eduISA::setMiscReg(int miscReg, MiscReg val, ThreadContext * tc) 1736313Sgblack@eecs.umich.edu{ 1746336Sgblack@eecs.umich.edu MiscReg newVal = val; 1756336Sgblack@eecs.umich.edu switch(miscReg) 1766336Sgblack@eecs.umich.edu { 1776336Sgblack@eecs.umich.edu case MISCREG_CR0: 1786336Sgblack@eecs.umich.edu { 1796336Sgblack@eecs.umich.edu CR0 toggled = regVal[miscReg] ^ val; 1806336Sgblack@eecs.umich.edu CR0 newCR0 = val; 1816336Sgblack@eecs.umich.edu Efer efer = regVal[MISCREG_EFER]; 1826336Sgblack@eecs.umich.edu if (toggled.pg && efer.lme) { 1836336Sgblack@eecs.umich.edu if (newCR0.pg) { 1846336Sgblack@eecs.umich.edu //Turning on long mode 1856336Sgblack@eecs.umich.edu efer.lma = 1; 1866336Sgblack@eecs.umich.edu regVal[MISCREG_EFER] = efer; 1876336Sgblack@eecs.umich.edu } else { 1886336Sgblack@eecs.umich.edu //Turning off long mode 1896336Sgblack@eecs.umich.edu efer.lma = 0; 1906336Sgblack@eecs.umich.edu regVal[MISCREG_EFER] = efer; 1916336Sgblack@eecs.umich.edu } 1926336Sgblack@eecs.umich.edu } 1936336Sgblack@eecs.umich.edu if (toggled.pg) { 1949423SAndreas.Sandberg@arm.com tc->getITBPtr()->flushAll(); 1959423SAndreas.Sandberg@arm.com tc->getDTBPtr()->flushAll(); 1966336Sgblack@eecs.umich.edu } 1976336Sgblack@eecs.umich.edu //This must always be 1. 1986336Sgblack@eecs.umich.edu newCR0.et = 1; 1996336Sgblack@eecs.umich.edu newVal = newCR0; 2006336Sgblack@eecs.umich.edu updateHandyM5Reg(regVal[MISCREG_EFER], 2016336Sgblack@eecs.umich.edu newCR0, 2026336Sgblack@eecs.umich.edu regVal[MISCREG_CS_ATTR], 2036336Sgblack@eecs.umich.edu regVal[MISCREG_SS_ATTR], 2049376Sgblack@eecs.umich.edu regVal[MISCREG_RFLAGS], 2059376Sgblack@eecs.umich.edu tc); 2066336Sgblack@eecs.umich.edu } 2076336Sgblack@eecs.umich.edu break; 2086336Sgblack@eecs.umich.edu case MISCREG_CR2: 2096336Sgblack@eecs.umich.edu break; 2106336Sgblack@eecs.umich.edu case MISCREG_CR3: 2119423SAndreas.Sandberg@arm.com tc->getITBPtr()->flushNonGlobal(); 2129423SAndreas.Sandberg@arm.com tc->getDTBPtr()->flushNonGlobal(); 2136336Sgblack@eecs.umich.edu break; 2146336Sgblack@eecs.umich.edu case MISCREG_CR4: 2156336Sgblack@eecs.umich.edu { 2166336Sgblack@eecs.umich.edu CR4 toggled = regVal[miscReg] ^ val; 2176336Sgblack@eecs.umich.edu if (toggled.pae || toggled.pse || toggled.pge) { 2189423SAndreas.Sandberg@arm.com tc->getITBPtr()->flushAll(); 2199423SAndreas.Sandberg@arm.com tc->getDTBPtr()->flushAll(); 2206336Sgblack@eecs.umich.edu } 2216336Sgblack@eecs.umich.edu } 2226336Sgblack@eecs.umich.edu break; 2236336Sgblack@eecs.umich.edu case MISCREG_CR8: 2246336Sgblack@eecs.umich.edu break; 2256336Sgblack@eecs.umich.edu case MISCREG_CS_ATTR: 2266336Sgblack@eecs.umich.edu { 2276336Sgblack@eecs.umich.edu SegAttr toggled = regVal[miscReg] ^ val; 2286336Sgblack@eecs.umich.edu SegAttr newCSAttr = val; 2296336Sgblack@eecs.umich.edu if (toggled.longMode) { 2306336Sgblack@eecs.umich.edu if (newCSAttr.longMode) { 2316336Sgblack@eecs.umich.edu regVal[MISCREG_ES_EFF_BASE] = 0; 2326336Sgblack@eecs.umich.edu regVal[MISCREG_CS_EFF_BASE] = 0; 2336336Sgblack@eecs.umich.edu regVal[MISCREG_SS_EFF_BASE] = 0; 2346336Sgblack@eecs.umich.edu regVal[MISCREG_DS_EFF_BASE] = 0; 2356336Sgblack@eecs.umich.edu } else { 2366336Sgblack@eecs.umich.edu regVal[MISCREG_ES_EFF_BASE] = regVal[MISCREG_ES_BASE]; 2376336Sgblack@eecs.umich.edu regVal[MISCREG_CS_EFF_BASE] = regVal[MISCREG_CS_BASE]; 2386336Sgblack@eecs.umich.edu regVal[MISCREG_SS_EFF_BASE] = regVal[MISCREG_SS_BASE]; 2396336Sgblack@eecs.umich.edu regVal[MISCREG_DS_EFF_BASE] = regVal[MISCREG_DS_BASE]; 2406336Sgblack@eecs.umich.edu } 2416336Sgblack@eecs.umich.edu } 2426336Sgblack@eecs.umich.edu updateHandyM5Reg(regVal[MISCREG_EFER], 2436336Sgblack@eecs.umich.edu regVal[MISCREG_CR0], 2446336Sgblack@eecs.umich.edu newCSAttr, 2456336Sgblack@eecs.umich.edu regVal[MISCREG_SS_ATTR], 2469376Sgblack@eecs.umich.edu regVal[MISCREG_RFLAGS], 2479376Sgblack@eecs.umich.edu tc); 2486336Sgblack@eecs.umich.edu } 2496336Sgblack@eecs.umich.edu break; 2506336Sgblack@eecs.umich.edu case MISCREG_SS_ATTR: 2516336Sgblack@eecs.umich.edu updateHandyM5Reg(regVal[MISCREG_EFER], 2526336Sgblack@eecs.umich.edu regVal[MISCREG_CR0], 2536336Sgblack@eecs.umich.edu regVal[MISCREG_CS_ATTR], 2546336Sgblack@eecs.umich.edu val, 2559376Sgblack@eecs.umich.edu regVal[MISCREG_RFLAGS], 2569376Sgblack@eecs.umich.edu tc); 2576336Sgblack@eecs.umich.edu break; 2586336Sgblack@eecs.umich.edu // These segments always actually use their bases, or in other words 2596336Sgblack@eecs.umich.edu // their effective bases must stay equal to their actual bases. 2606336Sgblack@eecs.umich.edu case MISCREG_FS_BASE: 2616336Sgblack@eecs.umich.edu case MISCREG_GS_BASE: 2626336Sgblack@eecs.umich.edu case MISCREG_HS_BASE: 2636336Sgblack@eecs.umich.edu case MISCREG_TSL_BASE: 2646336Sgblack@eecs.umich.edu case MISCREG_TSG_BASE: 2656336Sgblack@eecs.umich.edu case MISCREG_TR_BASE: 2666336Sgblack@eecs.umich.edu case MISCREG_IDTR_BASE: 2676336Sgblack@eecs.umich.edu regVal[MISCREG_SEG_EFF_BASE(miscReg - MISCREG_SEG_BASE_BASE)] = val; 2686336Sgblack@eecs.umich.edu break; 2696336Sgblack@eecs.umich.edu // These segments ignore their bases in 64 bit mode. 2706336Sgblack@eecs.umich.edu // their effective bases must stay equal to their actual bases. 2716336Sgblack@eecs.umich.edu case MISCREG_ES_BASE: 2726336Sgblack@eecs.umich.edu case MISCREG_CS_BASE: 2736336Sgblack@eecs.umich.edu case MISCREG_SS_BASE: 2746336Sgblack@eecs.umich.edu case MISCREG_DS_BASE: 2756336Sgblack@eecs.umich.edu { 2766336Sgblack@eecs.umich.edu Efer efer = regVal[MISCREG_EFER]; 2776336Sgblack@eecs.umich.edu SegAttr csAttr = regVal[MISCREG_CS_ATTR]; 2786336Sgblack@eecs.umich.edu if (!efer.lma || !csAttr.longMode) // Check for non 64 bit mode. 2796336Sgblack@eecs.umich.edu regVal[MISCREG_SEG_EFF_BASE(miscReg - 2806336Sgblack@eecs.umich.edu MISCREG_SEG_BASE_BASE)] = val; 2816336Sgblack@eecs.umich.edu } 2826336Sgblack@eecs.umich.edu break; 2836336Sgblack@eecs.umich.edu case MISCREG_TSC: 2846336Sgblack@eecs.umich.edu regVal[MISCREG_TSC] = val - tc->getCpuPtr()->curCycle(); 2856336Sgblack@eecs.umich.edu return; 2866336Sgblack@eecs.umich.edu case MISCREG_DR0: 2876336Sgblack@eecs.umich.edu case MISCREG_DR1: 2886336Sgblack@eecs.umich.edu case MISCREG_DR2: 2896336Sgblack@eecs.umich.edu case MISCREG_DR3: 2906336Sgblack@eecs.umich.edu /* These should eventually set up breakpoints. */ 2916336Sgblack@eecs.umich.edu break; 2926336Sgblack@eecs.umich.edu case MISCREG_DR4: 2936336Sgblack@eecs.umich.edu miscReg = MISCREG_DR6; 2946336Sgblack@eecs.umich.edu /* Fall through to have the same effects as DR6. */ 2956336Sgblack@eecs.umich.edu case MISCREG_DR6: 2966336Sgblack@eecs.umich.edu { 2976336Sgblack@eecs.umich.edu DR6 dr6 = regVal[MISCREG_DR6]; 2986336Sgblack@eecs.umich.edu DR6 newDR6 = val; 2996336Sgblack@eecs.umich.edu dr6.b0 = newDR6.b0; 3006336Sgblack@eecs.umich.edu dr6.b1 = newDR6.b1; 3016336Sgblack@eecs.umich.edu dr6.b2 = newDR6.b2; 3026336Sgblack@eecs.umich.edu dr6.b3 = newDR6.b3; 3036336Sgblack@eecs.umich.edu dr6.bd = newDR6.bd; 3046336Sgblack@eecs.umich.edu dr6.bs = newDR6.bs; 3056336Sgblack@eecs.umich.edu dr6.bt = newDR6.bt; 3066336Sgblack@eecs.umich.edu newVal = dr6; 3076336Sgblack@eecs.umich.edu } 3086336Sgblack@eecs.umich.edu break; 3096336Sgblack@eecs.umich.edu case MISCREG_DR5: 3106336Sgblack@eecs.umich.edu miscReg = MISCREG_DR7; 3116336Sgblack@eecs.umich.edu /* Fall through to have the same effects as DR7. */ 3126336Sgblack@eecs.umich.edu case MISCREG_DR7: 3136336Sgblack@eecs.umich.edu { 3146336Sgblack@eecs.umich.edu DR7 dr7 = regVal[MISCREG_DR7]; 3156336Sgblack@eecs.umich.edu DR7 newDR7 = val; 3166336Sgblack@eecs.umich.edu dr7.l0 = newDR7.l0; 3176336Sgblack@eecs.umich.edu dr7.g0 = newDR7.g0; 3186336Sgblack@eecs.umich.edu if (dr7.l0 || dr7.g0) { 3196336Sgblack@eecs.umich.edu panic("Debug register breakpoints not implemented.\n"); 3206336Sgblack@eecs.umich.edu } else { 3216336Sgblack@eecs.umich.edu /* Disable breakpoint 0. */ 3226336Sgblack@eecs.umich.edu } 3236336Sgblack@eecs.umich.edu dr7.l1 = newDR7.l1; 3246336Sgblack@eecs.umich.edu dr7.g1 = newDR7.g1; 3256336Sgblack@eecs.umich.edu if (dr7.l1 || dr7.g1) { 3266336Sgblack@eecs.umich.edu panic("Debug register breakpoints not implemented.\n"); 3276336Sgblack@eecs.umich.edu } else { 3286336Sgblack@eecs.umich.edu /* Disable breakpoint 1. */ 3296336Sgblack@eecs.umich.edu } 3306336Sgblack@eecs.umich.edu dr7.l2 = newDR7.l2; 3316336Sgblack@eecs.umich.edu dr7.g2 = newDR7.g2; 3326336Sgblack@eecs.umich.edu if (dr7.l2 || dr7.g2) { 3336336Sgblack@eecs.umich.edu panic("Debug register breakpoints not implemented.\n"); 3346336Sgblack@eecs.umich.edu } else { 3356336Sgblack@eecs.umich.edu /* Disable breakpoint 2. */ 3366336Sgblack@eecs.umich.edu } 3376336Sgblack@eecs.umich.edu dr7.l3 = newDR7.l3; 3386336Sgblack@eecs.umich.edu dr7.g3 = newDR7.g3; 3396336Sgblack@eecs.umich.edu if (dr7.l3 || dr7.g3) { 3406336Sgblack@eecs.umich.edu panic("Debug register breakpoints not implemented.\n"); 3416336Sgblack@eecs.umich.edu } else { 3426336Sgblack@eecs.umich.edu /* Disable breakpoint 3. */ 3436336Sgblack@eecs.umich.edu } 3446336Sgblack@eecs.umich.edu dr7.gd = newDR7.gd; 3456336Sgblack@eecs.umich.edu dr7.rw0 = newDR7.rw0; 3466336Sgblack@eecs.umich.edu dr7.len0 = newDR7.len0; 3476336Sgblack@eecs.umich.edu dr7.rw1 = newDR7.rw1; 3486336Sgblack@eecs.umich.edu dr7.len1 = newDR7.len1; 3496336Sgblack@eecs.umich.edu dr7.rw2 = newDR7.rw2; 3506336Sgblack@eecs.umich.edu dr7.len2 = newDR7.len2; 3516336Sgblack@eecs.umich.edu dr7.rw3 = newDR7.rw3; 3526336Sgblack@eecs.umich.edu dr7.len3 = newDR7.len3; 3536336Sgblack@eecs.umich.edu } 3546336Sgblack@eecs.umich.edu break; 3556336Sgblack@eecs.umich.edu case MISCREG_M5_REG: 3566336Sgblack@eecs.umich.edu // Writing anything to the m5reg with side effects makes it update 3576336Sgblack@eecs.umich.edu // based on the current values of the relevant registers. The actual 3586336Sgblack@eecs.umich.edu // value written is discarded. 3596336Sgblack@eecs.umich.edu updateHandyM5Reg(regVal[MISCREG_EFER], 3606336Sgblack@eecs.umich.edu regVal[MISCREG_CR0], 3616336Sgblack@eecs.umich.edu regVal[MISCREG_CS_ATTR], 3626336Sgblack@eecs.umich.edu regVal[MISCREG_SS_ATTR], 3639376Sgblack@eecs.umich.edu regVal[MISCREG_RFLAGS], 3649376Sgblack@eecs.umich.edu tc); 3656336Sgblack@eecs.umich.edu return; 3666336Sgblack@eecs.umich.edu default: 3676336Sgblack@eecs.umich.edu break; 3686336Sgblack@eecs.umich.edu } 3696336Sgblack@eecs.umich.edu setMiscRegNoEffect(miscReg, newVal); 3706336Sgblack@eecs.umich.edu} 3716336Sgblack@eecs.umich.edu 3726336Sgblack@eecs.umich.eduvoid 3739425SAndreas.Sandberg@ARM.comISA::serialize(std::ostream & os) 3746336Sgblack@eecs.umich.edu{ 3756336Sgblack@eecs.umich.edu SERIALIZE_ARRAY(regVal, NumMiscRegs); 3766336Sgblack@eecs.umich.edu} 3776336Sgblack@eecs.umich.edu 3786336Sgblack@eecs.umich.eduvoid 3799425SAndreas.Sandberg@ARM.comISA::unserialize(Checkpoint * cp, const std::string & section) 3806336Sgblack@eecs.umich.edu{ 3816336Sgblack@eecs.umich.edu UNSERIALIZE_ARRAY(regVal, NumMiscRegs); 3827533Ssteve.reinhardt@amd.com updateHandyM5Reg(regVal[MISCREG_EFER], 3837533Ssteve.reinhardt@amd.com regVal[MISCREG_CR0], 3847533Ssteve.reinhardt@amd.com regVal[MISCREG_CS_ATTR], 3857533Ssteve.reinhardt@amd.com regVal[MISCREG_SS_ATTR], 3869376Sgblack@eecs.umich.edu regVal[MISCREG_RFLAGS], 3879376Sgblack@eecs.umich.edu NULL); 3886313Sgblack@eecs.umich.edu} 3896313Sgblack@eecs.umich.edu 3909461Snilay@cs.wisc.eduvoid 3919461Snilay@cs.wisc.eduISA::startup(ThreadContext *tc) 3929461Snilay@cs.wisc.edu{ 3939461Snilay@cs.wisc.edu tc->getDecoderPtr()->setM5Reg(regVal[MISCREG_M5_REG]); 3949461Snilay@cs.wisc.edu} 3959461Snilay@cs.wisc.edu 3966313Sgblack@eecs.umich.edu} 3979384SAndreas.Sandberg@arm.com 3989384SAndreas.Sandberg@arm.comX86ISA::ISA * 3999384SAndreas.Sandberg@arm.comX86ISAParams::create() 4009384SAndreas.Sandberg@arm.com{ 4019384SAndreas.Sandberg@arm.com return new X86ISA::ISA(this); 4029384SAndreas.Sandberg@arm.com} 403