faults.cc revision 6049
15124Sgblack@eecs.umich.edu/* 25124Sgblack@eecs.umich.edu * Copyright (c) 2003-2007 The Regents of The University of Michigan 35124Sgblack@eecs.umich.edu * All rights reserved. 45124Sgblack@eecs.umich.edu * 55124Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 65124Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are 75124Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright 85124Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 95124Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 105124Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 115124Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution; 125124Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its 135124Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 145124Sgblack@eecs.umich.edu * this software without specific prior written permission. 155124Sgblack@eecs.umich.edu * 165124Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 175124Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 185124Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 195124Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 205124Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 215124Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 225124Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 235124Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 245124Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 255124Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 265124Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 275124Sgblack@eecs.umich.edu * 285124Sgblack@eecs.umich.edu * Authors: Gabe Black 295124Sgblack@eecs.umich.edu */ 305124Sgblack@eecs.umich.edu 315124Sgblack@eecs.umich.edu/* 325124Sgblack@eecs.umich.edu * Copyright (c) 2007 The Hewlett-Packard Development Company 335124Sgblack@eecs.umich.edu * All rights reserved. 345124Sgblack@eecs.umich.edu * 355124Sgblack@eecs.umich.edu * Redistribution and use of this software in source and binary forms, 365124Sgblack@eecs.umich.edu * with or without modification, are permitted provided that the 375124Sgblack@eecs.umich.edu * following conditions are met: 385124Sgblack@eecs.umich.edu * 395124Sgblack@eecs.umich.edu * The software must be used only for Non-Commercial Use which means any 405124Sgblack@eecs.umich.edu * use which is NOT directed to receiving any direct monetary 415124Sgblack@eecs.umich.edu * compensation for, or commercial advantage from such use. Illustrative 425124Sgblack@eecs.umich.edu * examples of non-commercial use are academic research, personal study, 435124Sgblack@eecs.umich.edu * teaching, education and corporate research & development. 445124Sgblack@eecs.umich.edu * Illustrative examples of commercial use are distributing products for 455124Sgblack@eecs.umich.edu * commercial advantage and providing services using the software for 465124Sgblack@eecs.umich.edu * commercial advantage. 475124Sgblack@eecs.umich.edu * 485124Sgblack@eecs.umich.edu * If you wish to use this software or functionality therein that may be 495124Sgblack@eecs.umich.edu * covered by patents for commercial use, please contact: 505124Sgblack@eecs.umich.edu * Director of Intellectual Property Licensing 515124Sgblack@eecs.umich.edu * Office of Strategy and Technology 525124Sgblack@eecs.umich.edu * Hewlett-Packard Company 535124Sgblack@eecs.umich.edu * 1501 Page Mill Road 545124Sgblack@eecs.umich.edu * Palo Alto, California 94304 555124Sgblack@eecs.umich.edu * 565124Sgblack@eecs.umich.edu * Redistributions of source code must retain the above copyright notice, 575124Sgblack@eecs.umich.edu * this list of conditions and the following disclaimer. Redistributions 585124Sgblack@eecs.umich.edu * in binary form must reproduce the above copyright notice, this list of 595124Sgblack@eecs.umich.edu * conditions and the following disclaimer in the documentation and/or 605124Sgblack@eecs.umich.edu * other materials provided with the distribution. Neither the name of 615124Sgblack@eecs.umich.edu * the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its 625124Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 635124Sgblack@eecs.umich.edu * this software without specific prior written permission. No right of 645124Sgblack@eecs.umich.edu * sublicense is granted herewith. Derivatives of the software and 655124Sgblack@eecs.umich.edu * output created using the software may be prepared, but only for 665124Sgblack@eecs.umich.edu * Non-Commercial Uses. Derivatives of the software may be shared with 675124Sgblack@eecs.umich.edu * others provided: (i) the others agree to abide by the list of 685124Sgblack@eecs.umich.edu * conditions herein which includes the Non-Commercial Use restrictions; 695124Sgblack@eecs.umich.edu * and (ii) such Derivatives of the software include the above copyright 705124Sgblack@eecs.umich.edu * notice to acknowledge the contribution from this software where 715124Sgblack@eecs.umich.edu * applicable, this list of conditions and the disclaimer below. 725124Sgblack@eecs.umich.edu * 735124Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 745124Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 755124Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 765124Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 775124Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 785124Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 795124Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 805124Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 815124Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 825124Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 835124Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 845124Sgblack@eecs.umich.edu * 855124Sgblack@eecs.umich.edu * Authors: Gabe Black 865124Sgblack@eecs.umich.edu */ 875124Sgblack@eecs.umich.edu 885681Sgblack@eecs.umich.edu#include "arch/x86/decoder.hh" 895124Sgblack@eecs.umich.edu#include "arch/x86/faults.hh" 905124Sgblack@eecs.umich.edu#include "base/trace.hh" 915124Sgblack@eecs.umich.edu#include "config/full_system.hh" 925124Sgblack@eecs.umich.edu#include "cpu/thread_context.hh" 935124Sgblack@eecs.umich.edu#if !FULL_SYSTEM 945124Sgblack@eecs.umich.edu#include "arch/x86/isa_traits.hh" 955124Sgblack@eecs.umich.edu#include "mem/page_table.hh" 965124Sgblack@eecs.umich.edu#include "sim/process.hh" 975237Sgblack@eecs.umich.edu#else 985237Sgblack@eecs.umich.edu#include "arch/x86/tlb.hh" 995124Sgblack@eecs.umich.edu#endif 1005124Sgblack@eecs.umich.edu 1015124Sgblack@eecs.umich.edunamespace X86ISA 1025124Sgblack@eecs.umich.edu{ 1035124Sgblack@eecs.umich.edu#if FULL_SYSTEM 1045858Sgblack@eecs.umich.edu void X86FaultBase::invoke(ThreadContext * tc) 1055124Sgblack@eecs.umich.edu { 1065909Sgblack@eecs.umich.edu Addr pc = tc->readPC(); 1075909Sgblack@eecs.umich.edu DPRINTF(Faults, "RIP %#x: vector %d: %s\n", pc, vector, describe()); 1085681Sgblack@eecs.umich.edu using namespace X86ISAInst::RomLabels; 1095681Sgblack@eecs.umich.edu HandyM5Reg m5reg = tc->readMiscRegNoEffect(MISCREG_M5_REG); 1105681Sgblack@eecs.umich.edu MicroPC entry; 1115681Sgblack@eecs.umich.edu if (m5reg.mode == LongMode) { 1125858Sgblack@eecs.umich.edu if (isSoft()) { 1135858Sgblack@eecs.umich.edu entry = extern_label_longModeSoftInterrupt; 1145858Sgblack@eecs.umich.edu } else { 1155858Sgblack@eecs.umich.edu entry = extern_label_longModeInterrupt; 1165858Sgblack@eecs.umich.edu } 1175681Sgblack@eecs.umich.edu } else { 1185681Sgblack@eecs.umich.edu entry = extern_label_legacyModeInterrupt; 1195681Sgblack@eecs.umich.edu } 1205681Sgblack@eecs.umich.edu tc->setIntReg(INTREG_MICRO(1), vector); 1215909Sgblack@eecs.umich.edu tc->setIntReg(INTREG_MICRO(7), pc); 1225857Sgblack@eecs.umich.edu if (errorCode != (uint64_t)(-1)) { 1235858Sgblack@eecs.umich.edu if (m5reg.mode == LongMode) { 1245858Sgblack@eecs.umich.edu entry = extern_label_longModeInterruptWithError; 1255858Sgblack@eecs.umich.edu } else { 1265858Sgblack@eecs.umich.edu panic("Legacy mode interrupts with error codes " 1275858Sgblack@eecs.umich.edu "aren't implementde.\n"); 1285858Sgblack@eecs.umich.edu } 1295858Sgblack@eecs.umich.edu // Software interrupts shouldn't have error codes. If one does, 1305858Sgblack@eecs.umich.edu // there would need to be microcode to set it up. 1315858Sgblack@eecs.umich.edu assert(!isSoft()); 1325857Sgblack@eecs.umich.edu tc->setIntReg(INTREG_MICRO(15), errorCode); 1335857Sgblack@eecs.umich.edu } 1345681Sgblack@eecs.umich.edu tc->setMicroPC(romMicroPC(entry)); 1355681Sgblack@eecs.umich.edu tc->setNextMicroPC(romMicroPC(entry) + 1); 1365124Sgblack@eecs.umich.edu } 1375909Sgblack@eecs.umich.edu 1385909Sgblack@eecs.umich.edu std::string 1395909Sgblack@eecs.umich.edu X86FaultBase::describe() const 1405909Sgblack@eecs.umich.edu { 1415909Sgblack@eecs.umich.edu std::stringstream ss; 1425909Sgblack@eecs.umich.edu ccprintf(ss, "%s", mnemonic()); 1435909Sgblack@eecs.umich.edu if (errorCode != (uint64_t)(-1)) { 1445909Sgblack@eecs.umich.edu ccprintf(ss, "(%#x)", errorCode); 1455909Sgblack@eecs.umich.edu } 1465909Sgblack@eecs.umich.edu 1475909Sgblack@eecs.umich.edu return ss.str(); 1485909Sgblack@eecs.umich.edu } 1495858Sgblack@eecs.umich.edu 1505858Sgblack@eecs.umich.edu void X86Trap::invoke(ThreadContext * tc) 1515858Sgblack@eecs.umich.edu { 1525858Sgblack@eecs.umich.edu X86FaultBase::invoke(tc); 1535858Sgblack@eecs.umich.edu // This is the same as a fault, but it happens -after- the instruction. 1545858Sgblack@eecs.umich.edu tc->setPC(tc->readNextPC()); 1555858Sgblack@eecs.umich.edu tc->setNextPC(tc->readNextNPC()); 1565858Sgblack@eecs.umich.edu tc->setNextNPC(tc->readNextNPC() + sizeof(MachInst)); 1575858Sgblack@eecs.umich.edu } 1585858Sgblack@eecs.umich.edu 1595858Sgblack@eecs.umich.edu void X86Abort::invoke(ThreadContext * tc) 1605858Sgblack@eecs.umich.edu { 1615858Sgblack@eecs.umich.edu panic("Abort exception!"); 1625858Sgblack@eecs.umich.edu } 1635858Sgblack@eecs.umich.edu 1645858Sgblack@eecs.umich.edu void PageFault::invoke(ThreadContext * tc) 1655858Sgblack@eecs.umich.edu { 1665858Sgblack@eecs.umich.edu HandyM5Reg m5reg = tc->readMiscRegNoEffect(MISCREG_M5_REG); 1675858Sgblack@eecs.umich.edu X86FaultBase::invoke(tc); 1685858Sgblack@eecs.umich.edu /* 1695858Sgblack@eecs.umich.edu * If something bad happens while trying to enter the page fault 1705858Sgblack@eecs.umich.edu * handler, I'm pretty sure that's a double fault and then all bets are 1715858Sgblack@eecs.umich.edu * off. That means it should be safe to update this state now. 1725858Sgblack@eecs.umich.edu */ 1735858Sgblack@eecs.umich.edu if (m5reg.mode == LongMode) { 1745858Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CR2, addr); 1755858Sgblack@eecs.umich.edu } else { 1765858Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CR2, (uint32_t)addr); 1775858Sgblack@eecs.umich.edu } 1785858Sgblack@eecs.umich.edu } 1795237Sgblack@eecs.umich.edu 1805909Sgblack@eecs.umich.edu std::string 1815909Sgblack@eecs.umich.edu PageFault::describe() const 1825909Sgblack@eecs.umich.edu { 1835909Sgblack@eecs.umich.edu std::stringstream ss; 1845909Sgblack@eecs.umich.edu ccprintf(ss, "%s at %#x", X86FaultBase::describe(), addr); 1855909Sgblack@eecs.umich.edu return ss.str(); 1865909Sgblack@eecs.umich.edu } 1875909Sgblack@eecs.umich.edu 1886048Sgblack@eecs.umich.edu void 1896048Sgblack@eecs.umich.edu InitInterrupt::invoke(ThreadContext *tc) 1906048Sgblack@eecs.umich.edu { 1916048Sgblack@eecs.umich.edu DPRINTF(Faults, "Init interrupt.\n"); 1926048Sgblack@eecs.umich.edu // The otherwise unmodified integer registers should be set to 0. 1936048Sgblack@eecs.umich.edu for (int index = 0; index < NUM_INTREGS; index++) { 1946048Sgblack@eecs.umich.edu tc->setIntReg(index, 0); 1956048Sgblack@eecs.umich.edu } 1966048Sgblack@eecs.umich.edu 1976048Sgblack@eecs.umich.edu CR0 cr0 = tc->readMiscReg(MISCREG_CR0); 1986048Sgblack@eecs.umich.edu CR0 newCR0 = 1 << 4; 1996048Sgblack@eecs.umich.edu newCR0.cd = cr0.cd; 2006048Sgblack@eecs.umich.edu newCR0.nw = cr0.nw; 2016048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CR0, newCR0); 2026048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CR2, 0); 2036048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CR3, 0); 2046048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CR4, 0); 2056048Sgblack@eecs.umich.edu 2066048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_RFLAGS, 0x0000000000000002ULL); 2076048Sgblack@eecs.umich.edu 2086048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_EFER, 0); 2096048Sgblack@eecs.umich.edu 2106048Sgblack@eecs.umich.edu SegAttr dataAttr = 0; 2116048Sgblack@eecs.umich.edu dataAttr.writable = 1; 2126048Sgblack@eecs.umich.edu dataAttr.readable = 1; 2136048Sgblack@eecs.umich.edu dataAttr.expandDown = 0; 2146048Sgblack@eecs.umich.edu dataAttr.dpl = 0; 2156048Sgblack@eecs.umich.edu dataAttr.defaultSize = 0; 2166048Sgblack@eecs.umich.edu 2176048Sgblack@eecs.umich.edu for (int seg = 0; seg != NUM_SEGMENTREGS; seg++) { 2186048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SEG_SEL(seg), 0); 2196048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SEG_BASE(seg), 0); 2206048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SEG_EFF_BASE(seg), 0); 2216048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SEG_LIMIT(seg), 0xffff); 2226048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SEG_ATTR(seg), dataAttr); 2236048Sgblack@eecs.umich.edu } 2246048Sgblack@eecs.umich.edu 2256048Sgblack@eecs.umich.edu SegAttr codeAttr = 0; 2266048Sgblack@eecs.umich.edu codeAttr.writable = 0; 2276048Sgblack@eecs.umich.edu codeAttr.readable = 1; 2286048Sgblack@eecs.umich.edu codeAttr.expandDown = 0; 2296048Sgblack@eecs.umich.edu codeAttr.dpl = 0; 2306048Sgblack@eecs.umich.edu codeAttr.defaultSize = 0; 2316048Sgblack@eecs.umich.edu 2326048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS, 0xf000); 2336048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS_BASE, 2346048Sgblack@eecs.umich.edu 0x00000000ffff0000ULL); 2356048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS_EFF_BASE, 2366048Sgblack@eecs.umich.edu 0x00000000ffff0000ULL); 2376048Sgblack@eecs.umich.edu // This has the base value pre-added. 2386048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS_LIMIT, 0xffffffff); 2396048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS_ATTR, codeAttr); 2406048Sgblack@eecs.umich.edu 2416048Sgblack@eecs.umich.edu tc->setPC(0x000000000000fff0ULL + 2426048Sgblack@eecs.umich.edu tc->readMiscReg(MISCREG_CS_BASE)); 2436048Sgblack@eecs.umich.edu tc->setNextPC(tc->readPC() + sizeof(MachInst)); 2446048Sgblack@eecs.umich.edu 2456048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TSG_BASE, 0); 2466048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TSG_LIMIT, 0xffff); 2476048Sgblack@eecs.umich.edu 2486048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_IDTR_BASE, 0); 2496048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_IDTR_LIMIT, 0xffff); 2506048Sgblack@eecs.umich.edu 2516048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TSL, 0); 2526048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TSL_BASE, 0); 2536048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TSL_LIMIT, 0xffff); 2546048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TSL_ATTR, 0); 2556048Sgblack@eecs.umich.edu 2566048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TR, 0); 2576048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TR_BASE, 0); 2586048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TR_LIMIT, 0xffff); 2596048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TR_ATTR, 0); 2606048Sgblack@eecs.umich.edu 2616048Sgblack@eecs.umich.edu // This value should be the family/model/stepping of the processor. 2626048Sgblack@eecs.umich.edu // (page 418). It should be consistent with the value from CPUID, but 2636048Sgblack@eecs.umich.edu // the actual value probably doesn't matter much. 2646048Sgblack@eecs.umich.edu tc->setIntReg(INTREG_RDX, 0); 2656048Sgblack@eecs.umich.edu 2666048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_DR0, 0); 2676048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_DR1, 0); 2686048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_DR2, 0); 2696048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_DR3, 0); 2706048Sgblack@eecs.umich.edu 2716048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_DR6, 0x00000000ffff0ff0ULL); 2726048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_DR7, 0x0000000000000400ULL); 2736048Sgblack@eecs.umich.edu 2746048Sgblack@eecs.umich.edu // We're now in real mode, effectively at CPL 0 2756048Sgblack@eecs.umich.edu HandyM5Reg m5Reg = 0; 2766048Sgblack@eecs.umich.edu m5Reg.mode = LegacyMode; 2776048Sgblack@eecs.umich.edu m5Reg.submode = RealMode; 2786048Sgblack@eecs.umich.edu m5Reg.cpl = 0; 2796048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_M5_REG, m5Reg); 2806048Sgblack@eecs.umich.edu MicroPC entry = X86ISAInst::RomLabels::extern_label_initIntHalt; 2816048Sgblack@eecs.umich.edu tc->setMicroPC(romMicroPC(entry)); 2826048Sgblack@eecs.umich.edu tc->setNextMicroPC(romMicroPC(entry) + 1); 2836048Sgblack@eecs.umich.edu } 2846048Sgblack@eecs.umich.edu 2856049Sgblack@eecs.umich.edu void 2866049Sgblack@eecs.umich.edu StartupInterrupt::invoke(ThreadContext *tc) 2876049Sgblack@eecs.umich.edu { 2886049Sgblack@eecs.umich.edu DPRINTF(Faults, "Startup interrupt with vector %#x.\n", vector); 2896049Sgblack@eecs.umich.edu HandyM5Reg m5Reg = tc->readMiscReg(MISCREG_M5_REG); 2906049Sgblack@eecs.umich.edu if (m5Reg.mode != LegacyMode || m5Reg.submode != RealMode) { 2916049Sgblack@eecs.umich.edu panic("Startup IPI recived outside of real mode. " 2926049Sgblack@eecs.umich.edu "Don't know what to do."); 2936049Sgblack@eecs.umich.edu } 2946049Sgblack@eecs.umich.edu 2956049Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS, vector << 8); 2966049Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS_BASE, vector << 12); 2976049Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS_EFF_BASE, vector << 12); 2986049Sgblack@eecs.umich.edu // This has the base value pre-added. 2996049Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS_LIMIT, 0xffff); 3006049Sgblack@eecs.umich.edu 3016049Sgblack@eecs.umich.edu tc->setPC(tc->readMiscReg(MISCREG_CS_BASE)); 3026049Sgblack@eecs.umich.edu tc->setNextPC(tc->readPC() + sizeof(MachInst)); 3036049Sgblack@eecs.umich.edu } 3046049Sgblack@eecs.umich.edu 3055124Sgblack@eecs.umich.edu#endif 3065124Sgblack@eecs.umich.edu} // namespace X86ISA 3075124Sgblack@eecs.umich.edu 308