faults.cc revision 12372
15124Sgblack@eecs.umich.edu/* 27087Snate@binkert.org * Copyright (c) 2007 The Hewlett-Packard Development Company 37087Snate@binkert.org * All rights reserved. 47087Snate@binkert.org * 57087Snate@binkert.org * The license below extends only to copyright in the software and shall 67087Snate@binkert.org * not be construed as granting a license to any other intellectual 77087Snate@binkert.org * property including but not limited to intellectual property relating 87087Snate@binkert.org * to a hardware implementation of the functionality of the software 97087Snate@binkert.org * licensed hereunder. You may use the software subject to the license 107087Snate@binkert.org * terms below provided that you ensure that this notice is replicated 117087Snate@binkert.org * unmodified and in its entirety in all distributions of the software, 127087Snate@binkert.org * modified or unmodified, in source code or in binary form. 137087Snate@binkert.org * 145124Sgblack@eecs.umich.edu * Copyright (c) 2003-2007 The Regents of The University of Michigan 155124Sgblack@eecs.umich.edu * All rights reserved. 165124Sgblack@eecs.umich.edu * 175124Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 185124Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are 195124Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright 205124Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 215124Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 225124Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 235124Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution; 245124Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its 255124Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 265124Sgblack@eecs.umich.edu * this software without specific prior written permission. 275124Sgblack@eecs.umich.edu * 285124Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 295124Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 305124Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 315124Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 325124Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 335124Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 345124Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 355124Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 365124Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 375124Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 385124Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 395124Sgblack@eecs.umich.edu * 405124Sgblack@eecs.umich.edu * Authors: Gabe Black 415124Sgblack@eecs.umich.edu */ 425124Sgblack@eecs.umich.edu 4311793Sbrandon.potter@amd.com#include "arch/x86/faults.hh" 4411793Sbrandon.potter@amd.com 458961Sgblack@eecs.umich.edu#include "arch/x86/generated/decoder.hh" 468740Sgblack@eecs.umich.edu#include "arch/x86/isa_traits.hh" 4712372Smattdsinclair@gmail.com#include "base/loader/symtab.hh" 485124Sgblack@eecs.umich.edu#include "base/trace.hh" 495124Sgblack@eecs.umich.edu#include "cpu/thread_context.hh" 508232Snate@binkert.org#include "debug/Faults.hh" 518740Sgblack@eecs.umich.edu#include "sim/full_system.hh" 525124Sgblack@eecs.umich.edu 535124Sgblack@eecs.umich.edunamespace X86ISA 545124Sgblack@eecs.umich.edu{ 5510417Sandreas.hansson@arm.com void X86FaultBase::invoke(ThreadContext * tc, const StaticInstPtr &inst) 565124Sgblack@eecs.umich.edu { 578806Sgblack@eecs.umich.edu if (!FullSystem) { 588806Sgblack@eecs.umich.edu FaultBase::invoke(tc, inst); 598806Sgblack@eecs.umich.edu return; 608806Sgblack@eecs.umich.edu } 618806Sgblack@eecs.umich.edu 628806Sgblack@eecs.umich.edu PCState pcState = tc->pcState(); 638806Sgblack@eecs.umich.edu Addr pc = pcState.pc(); 648806Sgblack@eecs.umich.edu DPRINTF(Faults, "RIP %#x: vector %d: %s\n", 658806Sgblack@eecs.umich.edu pc, vector, describe()); 668806Sgblack@eecs.umich.edu using namespace X86ISAInst::RomLabels; 678806Sgblack@eecs.umich.edu HandyM5Reg m5reg = tc->readMiscRegNoEffect(MISCREG_M5_REG); 688806Sgblack@eecs.umich.edu MicroPC entry; 698806Sgblack@eecs.umich.edu if (m5reg.mode == LongMode) { 708806Sgblack@eecs.umich.edu if (isSoft()) { 718806Sgblack@eecs.umich.edu entry = extern_label_longModeSoftInterrupt; 728806Sgblack@eecs.umich.edu } else { 738806Sgblack@eecs.umich.edu entry = extern_label_longModeInterrupt; 748806Sgblack@eecs.umich.edu } 758806Sgblack@eecs.umich.edu } else { 768806Sgblack@eecs.umich.edu entry = extern_label_legacyModeInterrupt; 778806Sgblack@eecs.umich.edu } 788806Sgblack@eecs.umich.edu tc->setIntReg(INTREG_MICRO(1), vector); 798806Sgblack@eecs.umich.edu tc->setIntReg(INTREG_MICRO(7), pc); 808806Sgblack@eecs.umich.edu if (errorCode != (uint64_t)(-1)) { 818740Sgblack@eecs.umich.edu if (m5reg.mode == LongMode) { 828806Sgblack@eecs.umich.edu entry = extern_label_longModeInterruptWithError; 835858Sgblack@eecs.umich.edu } else { 848806Sgblack@eecs.umich.edu panic("Legacy mode interrupts with error codes " 858806Sgblack@eecs.umich.edu "aren't implementde.\n"); 865858Sgblack@eecs.umich.edu } 878806Sgblack@eecs.umich.edu // Software interrupts shouldn't have error codes. If one 888806Sgblack@eecs.umich.edu // does, there would need to be microcode to set it up. 898806Sgblack@eecs.umich.edu assert(!isSoft()); 908806Sgblack@eecs.umich.edu tc->setIntReg(INTREG_MICRO(15), errorCode); 915681Sgblack@eecs.umich.edu } 928806Sgblack@eecs.umich.edu pcState.upc(romMicroPC(entry)); 938806Sgblack@eecs.umich.edu pcState.nupc(romMicroPC(entry) + 1); 948806Sgblack@eecs.umich.edu tc->pcState(pcState); 955124Sgblack@eecs.umich.edu } 965909Sgblack@eecs.umich.edu 975909Sgblack@eecs.umich.edu std::string 985909Sgblack@eecs.umich.edu X86FaultBase::describe() const 995909Sgblack@eecs.umich.edu { 1005909Sgblack@eecs.umich.edu std::stringstream ss; 1015909Sgblack@eecs.umich.edu ccprintf(ss, "%s", mnemonic()); 1025909Sgblack@eecs.umich.edu if (errorCode != (uint64_t)(-1)) { 1035909Sgblack@eecs.umich.edu ccprintf(ss, "(%#x)", errorCode); 1045909Sgblack@eecs.umich.edu } 1055909Sgblack@eecs.umich.edu 1065909Sgblack@eecs.umich.edu return ss.str(); 1075909Sgblack@eecs.umich.edu } 10811320Ssteve.reinhardt@amd.com 10910417Sandreas.hansson@arm.com void X86Trap::invoke(ThreadContext * tc, const StaticInstPtr &inst) 1105858Sgblack@eecs.umich.edu { 1115858Sgblack@eecs.umich.edu X86FaultBase::invoke(tc); 1128806Sgblack@eecs.umich.edu if (!FullSystem) 1138806Sgblack@eecs.umich.edu return; 1148806Sgblack@eecs.umich.edu 1158806Sgblack@eecs.umich.edu // This is the same as a fault, but it happens -after- the 1168806Sgblack@eecs.umich.edu // instruction. 1178806Sgblack@eecs.umich.edu PCState pc = tc->pcState(); 1188806Sgblack@eecs.umich.edu pc.uEnd(); 1195858Sgblack@eecs.umich.edu } 1205858Sgblack@eecs.umich.edu 12110417Sandreas.hansson@arm.com void X86Abort::invoke(ThreadContext * tc, const StaticInstPtr &inst) 1225858Sgblack@eecs.umich.edu { 1235858Sgblack@eecs.umich.edu panic("Abort exception!"); 1245858Sgblack@eecs.umich.edu } 1255858Sgblack@eecs.umich.edu 1268740Sgblack@eecs.umich.edu void 12710417Sandreas.hansson@arm.com InvalidOpcode::invoke(ThreadContext * tc, const StaticInstPtr &inst) 1288740Sgblack@eecs.umich.edu { 1298740Sgblack@eecs.umich.edu if (FullSystem) { 1308740Sgblack@eecs.umich.edu X86Fault::invoke(tc, inst); 1318740Sgblack@eecs.umich.edu } else { 1328740Sgblack@eecs.umich.edu panic("Unrecognized/invalid instruction executed:\n %s", 1338740Sgblack@eecs.umich.edu inst->machInst); 1348740Sgblack@eecs.umich.edu } 1358740Sgblack@eecs.umich.edu } 1368740Sgblack@eecs.umich.edu 13710417Sandreas.hansson@arm.com void PageFault::invoke(ThreadContext * tc, const StaticInstPtr &inst) 1385858Sgblack@eecs.umich.edu { 1398740Sgblack@eecs.umich.edu if (FullSystem) { 14011218Sswapnilh@cs.wisc.edu /* Invalidate any matching TLB entries before handling the page fault */ 14111218Sswapnilh@cs.wisc.edu tc->getITBPtr()->demapPage(addr, 0); 14211218Sswapnilh@cs.wisc.edu tc->getDTBPtr()->demapPage(addr, 0); 1438740Sgblack@eecs.umich.edu HandyM5Reg m5reg = tc->readMiscRegNoEffect(MISCREG_M5_REG); 1448740Sgblack@eecs.umich.edu X86FaultBase::invoke(tc); 1458740Sgblack@eecs.umich.edu /* 1468740Sgblack@eecs.umich.edu * If something bad happens while trying to enter the page fault 1478740Sgblack@eecs.umich.edu * handler, I'm pretty sure that's a double fault and then all 1488740Sgblack@eecs.umich.edu * bets are off. That means it should be safe to update this 1498740Sgblack@eecs.umich.edu * state now. 1508740Sgblack@eecs.umich.edu */ 1518740Sgblack@eecs.umich.edu if (m5reg.mode == LongMode) { 1528740Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CR2, addr); 1538740Sgblack@eecs.umich.edu } else { 1548740Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CR2, (uint32_t)addr); 1558740Sgblack@eecs.umich.edu } 1565858Sgblack@eecs.umich.edu } else { 1578740Sgblack@eecs.umich.edu PageFaultErrorCode code = errorCode; 1588740Sgblack@eecs.umich.edu const char *modeStr = ""; 1598740Sgblack@eecs.umich.edu if (code.fetch) 1608740Sgblack@eecs.umich.edu modeStr = "execute"; 1618740Sgblack@eecs.umich.edu else if (code.write) 1628740Sgblack@eecs.umich.edu modeStr = "write"; 1638740Sgblack@eecs.umich.edu else 1648740Sgblack@eecs.umich.edu modeStr = "read"; 16512372Smattdsinclair@gmail.com 16612372Smattdsinclair@gmail.com // print information about what we are panic'ing on 16712372Smattdsinclair@gmail.com if (!inst) { 16812372Smattdsinclair@gmail.com panic("Tried to %s unmapped address %#x.\n", modeStr, addr); 16912372Smattdsinclair@gmail.com } else { 17012372Smattdsinclair@gmail.com panic("Tried to %s unmapped address %#x.\nPC: %#x, Instr: %s", 17112372Smattdsinclair@gmail.com modeStr, addr, tc->pcState().pc(), 17212372Smattdsinclair@gmail.com inst->disassemble(tc->pcState().pc(), debugSymbolTable)); 17312372Smattdsinclair@gmail.com } 1745858Sgblack@eecs.umich.edu } 1755858Sgblack@eecs.umich.edu } 1765237Sgblack@eecs.umich.edu 1775909Sgblack@eecs.umich.edu std::string 1785909Sgblack@eecs.umich.edu PageFault::describe() const 1795909Sgblack@eecs.umich.edu { 1805909Sgblack@eecs.umich.edu std::stringstream ss; 1815909Sgblack@eecs.umich.edu ccprintf(ss, "%s at %#x", X86FaultBase::describe(), addr); 1825909Sgblack@eecs.umich.edu return ss.str(); 1835909Sgblack@eecs.umich.edu } 1845909Sgblack@eecs.umich.edu 1856048Sgblack@eecs.umich.edu void 18610417Sandreas.hansson@arm.com InitInterrupt::invoke(ThreadContext *tc, const StaticInstPtr &inst) 1876048Sgblack@eecs.umich.edu { 1886048Sgblack@eecs.umich.edu DPRINTF(Faults, "Init interrupt.\n"); 1896048Sgblack@eecs.umich.edu // The otherwise unmodified integer registers should be set to 0. 1906048Sgblack@eecs.umich.edu for (int index = 0; index < NUM_INTREGS; index++) { 1916048Sgblack@eecs.umich.edu tc->setIntReg(index, 0); 1926048Sgblack@eecs.umich.edu } 1936048Sgblack@eecs.umich.edu 1946048Sgblack@eecs.umich.edu CR0 cr0 = tc->readMiscReg(MISCREG_CR0); 1956048Sgblack@eecs.umich.edu CR0 newCR0 = 1 << 4; 1966048Sgblack@eecs.umich.edu newCR0.cd = cr0.cd; 1976048Sgblack@eecs.umich.edu newCR0.nw = cr0.nw; 1986048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CR0, newCR0); 1996048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CR2, 0); 2006048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CR3, 0); 2016048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CR4, 0); 2026048Sgblack@eecs.umich.edu 2036048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_RFLAGS, 0x0000000000000002ULL); 2046048Sgblack@eecs.umich.edu 2056048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_EFER, 0); 2066048Sgblack@eecs.umich.edu 2076048Sgblack@eecs.umich.edu SegAttr dataAttr = 0; 2086222Sgblack@eecs.umich.edu dataAttr.dpl = 0; 2096222Sgblack@eecs.umich.edu dataAttr.unusable = 0; 2106222Sgblack@eecs.umich.edu dataAttr.defaultSize = 0; 2116222Sgblack@eecs.umich.edu dataAttr.longMode = 0; 2126222Sgblack@eecs.umich.edu dataAttr.avl = 0; 2136222Sgblack@eecs.umich.edu dataAttr.granularity = 0; 2146222Sgblack@eecs.umich.edu dataAttr.present = 1; 2156222Sgblack@eecs.umich.edu dataAttr.type = 3; 2166048Sgblack@eecs.umich.edu dataAttr.writable = 1; 2176048Sgblack@eecs.umich.edu dataAttr.readable = 1; 2186048Sgblack@eecs.umich.edu dataAttr.expandDown = 0; 2196222Sgblack@eecs.umich.edu dataAttr.system = 1; 2206048Sgblack@eecs.umich.edu 2216048Sgblack@eecs.umich.edu for (int seg = 0; seg != NUM_SEGMENTREGS; seg++) { 2226048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SEG_SEL(seg), 0); 2236048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SEG_BASE(seg), 0); 2246048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SEG_EFF_BASE(seg), 0); 2256048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SEG_LIMIT(seg), 0xffff); 2266048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SEG_ATTR(seg), dataAttr); 2276048Sgblack@eecs.umich.edu } 2286048Sgblack@eecs.umich.edu 2296048Sgblack@eecs.umich.edu SegAttr codeAttr = 0; 2306222Sgblack@eecs.umich.edu codeAttr.dpl = 0; 2316222Sgblack@eecs.umich.edu codeAttr.unusable = 0; 2326222Sgblack@eecs.umich.edu codeAttr.defaultSize = 0; 2336222Sgblack@eecs.umich.edu codeAttr.longMode = 0; 2346222Sgblack@eecs.umich.edu codeAttr.avl = 0; 2356222Sgblack@eecs.umich.edu codeAttr.granularity = 0; 2366222Sgblack@eecs.umich.edu codeAttr.present = 1; 2376222Sgblack@eecs.umich.edu codeAttr.type = 10; 2386048Sgblack@eecs.umich.edu codeAttr.writable = 0; 2396048Sgblack@eecs.umich.edu codeAttr.readable = 1; 2406048Sgblack@eecs.umich.edu codeAttr.expandDown = 0; 2416222Sgblack@eecs.umich.edu codeAttr.system = 1; 2426048Sgblack@eecs.umich.edu 2436048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS, 0xf000); 2446048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS_BASE, 2456048Sgblack@eecs.umich.edu 0x00000000ffff0000ULL); 2466048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS_EFF_BASE, 2476048Sgblack@eecs.umich.edu 0x00000000ffff0000ULL); 2486048Sgblack@eecs.umich.edu // This has the base value pre-added. 2496048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS_LIMIT, 0xffffffff); 2506048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS_ATTR, codeAttr); 2516048Sgblack@eecs.umich.edu 2527720Sgblack@eecs.umich.edu PCState pc(0x000000000000fff0ULL + tc->readMiscReg(MISCREG_CS_BASE)); 2537720Sgblack@eecs.umich.edu tc->pcState(pc); 2546048Sgblack@eecs.umich.edu 2556048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TSG_BASE, 0); 2566048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TSG_LIMIT, 0xffff); 2576048Sgblack@eecs.umich.edu 2586048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_IDTR_BASE, 0); 2596048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_IDTR_LIMIT, 0xffff); 2606048Sgblack@eecs.umich.edu 26110100Sandreas@sandberg.pp.se SegAttr tslAttr = 0; 26210100Sandreas@sandberg.pp.se tslAttr.present = 1; 26310100Sandreas@sandberg.pp.se tslAttr.type = 2; // LDT 2646048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TSL, 0); 2656048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TSL_BASE, 0); 2666048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TSL_LIMIT, 0xffff); 26710100Sandreas@sandberg.pp.se tc->setMiscReg(MISCREG_TSL_ATTR, tslAttr); 2686048Sgblack@eecs.umich.edu 26910100Sandreas@sandberg.pp.se SegAttr trAttr = 0; 27010100Sandreas@sandberg.pp.se trAttr.present = 1; 27110100Sandreas@sandberg.pp.se trAttr.type = 3; // Busy 16-bit TSS 2726048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TR, 0); 2736048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TR_BASE, 0); 2746048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TR_LIMIT, 0xffff); 27510100Sandreas@sandberg.pp.se tc->setMiscReg(MISCREG_TR_ATTR, trAttr); 2766048Sgblack@eecs.umich.edu 2776048Sgblack@eecs.umich.edu // This value should be the family/model/stepping of the processor. 2786048Sgblack@eecs.umich.edu // (page 418). It should be consistent with the value from CPUID, but 2796048Sgblack@eecs.umich.edu // the actual value probably doesn't matter much. 2806048Sgblack@eecs.umich.edu tc->setIntReg(INTREG_RDX, 0); 2816048Sgblack@eecs.umich.edu 2826048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_DR0, 0); 2836048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_DR1, 0); 2846048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_DR2, 0); 2856048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_DR3, 0); 2866048Sgblack@eecs.umich.edu 2876048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_DR6, 0x00000000ffff0ff0ULL); 2886048Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_DR7, 0x0000000000000400ULL); 2896048Sgblack@eecs.umich.edu 2909763Sandreas@sandberg.pp.se tc->setMiscReg(MISCREG_MXCSR, 0x1f80); 2919763Sandreas@sandberg.pp.se 2929765Sandreas@sandberg.pp.se // Flag all elements on the x87 stack as empty. 2939765Sandreas@sandberg.pp.se tc->setMiscReg(MISCREG_FTW, 0xFFFF); 2949765Sandreas@sandberg.pp.se 2956140Sgblack@eecs.umich.edu // Update the handy M5 Reg. 2966140Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_M5_REG, 0); 2976048Sgblack@eecs.umich.edu MicroPC entry = X86ISAInst::RomLabels::extern_label_initIntHalt; 2987720Sgblack@eecs.umich.edu pc.upc(romMicroPC(entry)); 2997720Sgblack@eecs.umich.edu pc.nupc(romMicroPC(entry) + 1); 3007720Sgblack@eecs.umich.edu tc->pcState(pc); 3016048Sgblack@eecs.umich.edu } 3026048Sgblack@eecs.umich.edu 3036049Sgblack@eecs.umich.edu void 30410417Sandreas.hansson@arm.com StartupInterrupt::invoke(ThreadContext *tc, const StaticInstPtr &inst) 3056049Sgblack@eecs.umich.edu { 3066049Sgblack@eecs.umich.edu DPRINTF(Faults, "Startup interrupt with vector %#x.\n", vector); 3076049Sgblack@eecs.umich.edu HandyM5Reg m5Reg = tc->readMiscReg(MISCREG_M5_REG); 3086049Sgblack@eecs.umich.edu if (m5Reg.mode != LegacyMode || m5Reg.submode != RealMode) { 3096049Sgblack@eecs.umich.edu panic("Startup IPI recived outside of real mode. " 3106140Sgblack@eecs.umich.edu "Don't know what to do. %d, %d", m5Reg.mode, m5Reg.submode); 3116049Sgblack@eecs.umich.edu } 3126049Sgblack@eecs.umich.edu 3136049Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS, vector << 8); 3146049Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS_BASE, vector << 12); 3156049Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS_EFF_BASE, vector << 12); 3166049Sgblack@eecs.umich.edu // This has the base value pre-added. 3176049Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS_LIMIT, 0xffff); 3186049Sgblack@eecs.umich.edu 3197720Sgblack@eecs.umich.edu tc->pcState(tc->readMiscReg(MISCREG_CS_BASE)); 3206049Sgblack@eecs.umich.edu } 3215124Sgblack@eecs.umich.edu} // namespace X86ISA 3225124Sgblack@eecs.umich.edu 323