utility.cc revision 5648
15086Sgblack@eecs.umich.edu/* 25086Sgblack@eecs.umich.edu * Copyright (c) 2007 The Hewlett-Packard Development Company 35086Sgblack@eecs.umich.edu * All rights reserved. 45086Sgblack@eecs.umich.edu * 55086Sgblack@eecs.umich.edu * Redistribution and use of this software in source and binary forms, 65086Sgblack@eecs.umich.edu * with or without modification, are permitted provided that the 75086Sgblack@eecs.umich.edu * following conditions are met: 85086Sgblack@eecs.umich.edu * 95086Sgblack@eecs.umich.edu * The software must be used only for Non-Commercial Use which means any 105086Sgblack@eecs.umich.edu * use which is NOT directed to receiving any direct monetary 115086Sgblack@eecs.umich.edu * compensation for, or commercial advantage from such use. Illustrative 125086Sgblack@eecs.umich.edu * examples of non-commercial use are academic research, personal study, 135086Sgblack@eecs.umich.edu * teaching, education and corporate research & development. 145086Sgblack@eecs.umich.edu * Illustrative examples of commercial use are distributing products for 155086Sgblack@eecs.umich.edu * commercial advantage and providing services using the software for 165086Sgblack@eecs.umich.edu * commercial advantage. 175086Sgblack@eecs.umich.edu * 185086Sgblack@eecs.umich.edu * If you wish to use this software or functionality therein that may be 195086Sgblack@eecs.umich.edu * covered by patents for commercial use, please contact: 205086Sgblack@eecs.umich.edu * Director of Intellectual Property Licensing 215086Sgblack@eecs.umich.edu * Office of Strategy and Technology 225086Sgblack@eecs.umich.edu * Hewlett-Packard Company 235086Sgblack@eecs.umich.edu * 1501 Page Mill Road 245086Sgblack@eecs.umich.edu * Palo Alto, California 94304 255086Sgblack@eecs.umich.edu * 265086Sgblack@eecs.umich.edu * Redistributions of source code must retain the above copyright notice, 275086Sgblack@eecs.umich.edu * this list of conditions and the following disclaimer. Redistributions 285086Sgblack@eecs.umich.edu * in binary form must reproduce the above copyright notice, this list of 295086Sgblack@eecs.umich.edu * conditions and the following disclaimer in the documentation and/or 305086Sgblack@eecs.umich.edu * other materials provided with the distribution. Neither the name of 315086Sgblack@eecs.umich.edu * the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its 325086Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 335086Sgblack@eecs.umich.edu * this software without specific prior written permission. No right of 345086Sgblack@eecs.umich.edu * sublicense is granted herewith. Derivatives of the software and 355086Sgblack@eecs.umich.edu * output created using the software may be prepared, but only for 365086Sgblack@eecs.umich.edu * Non-Commercial Uses. Derivatives of the software may be shared with 375086Sgblack@eecs.umich.edu * others provided: (i) the others agree to abide by the list of 385086Sgblack@eecs.umich.edu * conditions herein which includes the Non-Commercial Use restrictions; 395086Sgblack@eecs.umich.edu * and (ii) such Derivatives of the software include the above copyright 405086Sgblack@eecs.umich.edu * notice to acknowledge the contribution from this software where 415086Sgblack@eecs.umich.edu * applicable, this list of conditions and the disclaimer below. 425086Sgblack@eecs.umich.edu * 435086Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 445086Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 455086Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 465086Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 475086Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 485086Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 495086Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 505086Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 515086Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 525086Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 535086Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 545086Sgblack@eecs.umich.edu * 555086Sgblack@eecs.umich.edu * Authors: Gabe Black 565086Sgblack@eecs.umich.edu */ 575086Sgblack@eecs.umich.edu 585647Sgblack@eecs.umich.edu#include "config/full_system.hh" 595647Sgblack@eecs.umich.edu 605647Sgblack@eecs.umich.edu#if FULL_SYSTEM 615647Sgblack@eecs.umich.edu#include "arch/x86/interrupts.hh" 625647Sgblack@eecs.umich.edu#endif 635135Sgblack@eecs.umich.edu#include "arch/x86/intregs.hh" 645135Sgblack@eecs.umich.edu#include "arch/x86/miscregs.hh" 655135Sgblack@eecs.umich.edu#include "arch/x86/segmentregs.hh" 665086Sgblack@eecs.umich.edu#include "arch/x86/utility.hh" 675135Sgblack@eecs.umich.edu#include "arch/x86/x86_traits.hh" 685647Sgblack@eecs.umich.edu#include "cpu/base.hh" 695234Sgblack@eecs.umich.edu#include "sim/system.hh" 705086Sgblack@eecs.umich.edu 715086Sgblack@eecs.umich.edunamespace X86ISA { 725086Sgblack@eecs.umich.edu 735086Sgblack@eecs.umich.eduuint64_t getArgument(ThreadContext *tc, int number, bool fp) { 745086Sgblack@eecs.umich.edu#if FULL_SYSTEM 755086Sgblack@eecs.umich.edu panic("getArgument() not implemented for x86!\n"); 765086Sgblack@eecs.umich.edu#else 775086Sgblack@eecs.umich.edu panic("getArgument() only implemented for FULL_SYSTEM\n"); 785086Sgblack@eecs.umich.edu M5_DUMMY_RETURN 795086Sgblack@eecs.umich.edu#endif 805086Sgblack@eecs.umich.edu} 815135Sgblack@eecs.umich.edu 825135Sgblack@eecs.umich.edu# if FULL_SYSTEM 835135Sgblack@eecs.umich.eduvoid initCPU(ThreadContext *tc, int cpuId) 845135Sgblack@eecs.umich.edu{ 855135Sgblack@eecs.umich.edu // The otherwise unmodified integer registers should be set to 0. 865135Sgblack@eecs.umich.edu for (int index = 0; index < NUM_INTREGS; index++) { 875135Sgblack@eecs.umich.edu tc->setIntReg(index, 0); 885135Sgblack@eecs.umich.edu } 895135Sgblack@eecs.umich.edu 905135Sgblack@eecs.umich.edu // These next two loops zero internal microcode and implicit registers. 915135Sgblack@eecs.umich.edu // They aren't specified by the ISA but are used internally by M5's 925135Sgblack@eecs.umich.edu // implementation. 935135Sgblack@eecs.umich.edu for (int index = 0; index < NumMicroIntRegs; index++) { 945135Sgblack@eecs.umich.edu tc->setIntReg(INTREG_MICRO(index), 0); 955135Sgblack@eecs.umich.edu } 965135Sgblack@eecs.umich.edu 975135Sgblack@eecs.umich.edu for (int index = 0; index < NumImplicitIntRegs; index++) { 985135Sgblack@eecs.umich.edu tc->setIntReg(INTREG_IMPLICIT(index), 0); 995135Sgblack@eecs.umich.edu } 1005135Sgblack@eecs.umich.edu 1015135Sgblack@eecs.umich.edu // Set integer register EAX to 0 to indicate that the optional BIST 1025135Sgblack@eecs.umich.edu // passed. No BIST actually runs, but software may still check this 1035135Sgblack@eecs.umich.edu // register for errors. 1045135Sgblack@eecs.umich.edu tc->setIntReg(INTREG_RAX, 0); 1055135Sgblack@eecs.umich.edu 1065135Sgblack@eecs.umich.edu //The following values are dictated by the architecture for after a RESET# 1075264Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CR0, 0x0000000060000010ULL); 1085135Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CR2, 0); 1095135Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CR3, 0); 1105135Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CR4, 0); 1115135Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CR8, 0); 1125135Sgblack@eecs.umich.edu 1135264Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_RFLAGS, 0x0000000000000002ULL); 1145135Sgblack@eecs.umich.edu 1155135Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_EFER, 0); 1165135Sgblack@eecs.umich.edu 1175141Sgblack@eecs.umich.edu SegAttr dataAttr = 0; 1185141Sgblack@eecs.umich.edu dataAttr.writable = 1; 1195141Sgblack@eecs.umich.edu dataAttr.readable = 1; 1205141Sgblack@eecs.umich.edu dataAttr.expandDown = 0; 1215141Sgblack@eecs.umich.edu dataAttr.dpl = 0; 1225141Sgblack@eecs.umich.edu dataAttr.defaultSize = 0; 1235141Sgblack@eecs.umich.edu 1245135Sgblack@eecs.umich.edu for (int seg = 0; seg != NUM_SEGMENTREGS; seg++) { 1255135Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SEG_SEL(seg), 0); 1265135Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SEG_BASE(seg), 0); 1275289Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SEG_EFF_BASE(seg), 0); 1285135Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SEG_LIMIT(seg), 0xffff); 1295141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SEG_ATTR(seg), dataAttr); 1305135Sgblack@eecs.umich.edu } 1315135Sgblack@eecs.umich.edu 1325141Sgblack@eecs.umich.edu SegAttr codeAttr = 0; 1335141Sgblack@eecs.umich.edu codeAttr.writable = 0; 1345141Sgblack@eecs.umich.edu codeAttr.readable = 1; 1355141Sgblack@eecs.umich.edu codeAttr.expandDown = 0; 1365141Sgblack@eecs.umich.edu codeAttr.dpl = 0; 1375141Sgblack@eecs.umich.edu codeAttr.defaultSize = 0; 1385141Sgblack@eecs.umich.edu 1395135Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS, 0xf000); 1405289Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS_BASE, 1415289Sgblack@eecs.umich.edu 0x00000000ffff0000ULL); 1425289Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS_EFF_BASE, 1435289Sgblack@eecs.umich.edu 0x00000000ffff0000ULL); 1445135Sgblack@eecs.umich.edu // This has the base value pre-added. 1455135Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS_LIMIT, 0xffffffff); 1465141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CS_ATTR, codeAttr); 1475135Sgblack@eecs.umich.edu 1485264Sgblack@eecs.umich.edu tc->setPC(0x000000000000fff0ULL + 1495135Sgblack@eecs.umich.edu tc->readMiscReg(MISCREG_CS_BASE)); 1505135Sgblack@eecs.umich.edu tc->setNextPC(tc->readPC() + sizeof(MachInst)); 1515135Sgblack@eecs.umich.edu 1525294Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TSG_BASE, 0); 1535294Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TSG_LIMIT, 0xffff); 1545135Sgblack@eecs.umich.edu 1555135Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_IDTR_BASE, 0); 1565135Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_IDTR_LIMIT, 0xffff); 1575135Sgblack@eecs.umich.edu 1585294Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TSL, 0); 1595294Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TSL_BASE, 0); 1605294Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TSL_LIMIT, 0xffff); 1615294Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TSL_ATTR, 0); 1625135Sgblack@eecs.umich.edu 1635135Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TR, 0); 1645135Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TR_BASE, 0); 1655135Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TR_LIMIT, 0xffff); 1665135Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TR_ATTR, 0); 1675135Sgblack@eecs.umich.edu 1685135Sgblack@eecs.umich.edu // This value should be the family/model/stepping of the processor. 1695135Sgblack@eecs.umich.edu // (page 418). It should be consistent with the value from CPUID, but the 1705135Sgblack@eecs.umich.edu // actual value probably doesn't matter much. 1715135Sgblack@eecs.umich.edu tc->setIntReg(INTREG_RDX, 0); 1725135Sgblack@eecs.umich.edu 1735135Sgblack@eecs.umich.edu // TODO initialize x87, 64 bit, and 128 bit media state 1745135Sgblack@eecs.umich.edu 1755141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MTRRCAP, 0x0508); 1765141Sgblack@eecs.umich.edu for (int i = 0; i < 8; i++) { 1775141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MTRR_PHYS_BASE(i), 0); 1785141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MTRR_PHYS_MASK(i), 0); 1795141Sgblack@eecs.umich.edu } 1805141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MTRR_FIX_64K_00000, 0); 1815141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MTRR_FIX_16K_80000, 0); 1825141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MTRR_FIX_16K_A0000, 0); 1835141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MTRR_FIX_4K_C0000, 0); 1845182Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MTRR_FIX_4K_C8000, 0); 1855141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MTRR_FIX_4K_D0000, 0); 1865141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MTRR_FIX_4K_D8000, 0); 1875141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MTRR_FIX_4K_E0000, 0); 1885141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MTRR_FIX_4K_E8000, 0); 1895141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MTRR_FIX_4K_F0000, 0); 1905141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MTRR_FIX_4K_F8000, 0); 1915135Sgblack@eecs.umich.edu 1925141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_DEF_TYPE, 0); 1935141Sgblack@eecs.umich.edu 1945141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MCG_CAP, 0x104); 1955141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MCG_STATUS, 0); 1965141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MCG_CTL, 0); 1975141Sgblack@eecs.umich.edu 1985141Sgblack@eecs.umich.edu for (int i = 0; i < 5; i++) { 1995141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MC_CTL(i), 0); 2005141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MC_STATUS(i), 0); 2015141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MC_ADDR(i), 0); 2025141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_MC_MISC(i), 0); 2035141Sgblack@eecs.umich.edu } 2045135Sgblack@eecs.umich.edu 2055135Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_DR0, 0); 2065135Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_DR1, 0); 2075135Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_DR2, 0); 2085135Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_DR3, 0); 2095135Sgblack@eecs.umich.edu 2105264Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_DR6, 0x00000000ffff0ff0ULL); 2115264Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_DR7, 0x0000000000000400ULL); 2125135Sgblack@eecs.umich.edu 2135141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TSC, 0); 2145141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TSC_AUX, 0); 2155135Sgblack@eecs.umich.edu 2165141Sgblack@eecs.umich.edu for (int i = 0; i < 4; i++) { 2175141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_PERF_EVT_SEL(i), 0); 2185141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_PERF_EVT_CTR(i), 0); 2195141Sgblack@eecs.umich.edu } 2205135Sgblack@eecs.umich.edu 2215141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_STAR, 0); 2225141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_LSTAR, 0); 2235141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_CSTAR, 0); 2245141Sgblack@eecs.umich.edu 2255141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SF_MASK, 0); 2265141Sgblack@eecs.umich.edu 2275141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_KERNEL_GS_BASE, 0); 2285141Sgblack@eecs.umich.edu 2295141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SYSENTER_CS, 0); 2305141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SYSENTER_ESP, 0); 2315141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SYSENTER_EIP, 0); 2325141Sgblack@eecs.umich.edu 2335264Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_PAT, 0x0007040600070406ULL); 2345141Sgblack@eecs.umich.edu 2355141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SYSCFG, 0x20601); 2365141Sgblack@eecs.umich.edu 2375141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_IORR_BASE0, 0); 2385141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_IORR_BASE1, 0); 2395141Sgblack@eecs.umich.edu 2405141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_IORR_MASK0, 0); 2415141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_IORR_MASK1, 0); 2425141Sgblack@eecs.umich.edu 2435141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TOP_MEM, 0x4000000); 2445141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_TOP_MEM2, 0x0); 2455141Sgblack@eecs.umich.edu 2465141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_DEBUG_CTL_MSR, 0); 2475141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_LAST_BRANCH_FROM_IP, 0); 2485141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_LAST_BRANCH_TO_IP, 0); 2495141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_LAST_EXCEPTION_FROM_IP, 0); 2505141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_LAST_EXCEPTION_TO_IP, 0); 2515135Sgblack@eecs.umich.edu 2525135Sgblack@eecs.umich.edu // Invalidate the caches (this should already be done for us) 2535135Sgblack@eecs.umich.edu 2545135Sgblack@eecs.umich.edu // TODO Turn on the APIC. This should be handled elsewhere but it isn't 2555135Sgblack@eecs.umich.edu // currently being handled at all. 2565135Sgblack@eecs.umich.edu 2575360Sgblack@eecs.umich.edu LocalApicBase lApicBase = 0; 2585360Sgblack@eecs.umich.edu lApicBase.base = 0xFEE00000 >> 12; 2595360Sgblack@eecs.umich.edu lApicBase.enable = 1; 2605360Sgblack@eecs.umich.edu lApicBase.bsp = (cpuId == 0); 2615360Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_APIC_BASE, lApicBase); 2625360Sgblack@eecs.umich.edu 2635647Sgblack@eecs.umich.edu Interrupts * interrupts = dynamic_cast<Interrupts *>( 2645647Sgblack@eecs.umich.edu tc->getCpuPtr()->getInterruptController()); 2655647Sgblack@eecs.umich.edu assert(interrupts); 2665360Sgblack@eecs.umich.edu 2675647Sgblack@eecs.umich.edu interrupts->setRegNoEffect(APIC_ID, cpuId << 24); 2685647Sgblack@eecs.umich.edu 2695647Sgblack@eecs.umich.edu interrupts->setRegNoEffect(APIC_VERSION, (5 << 16) | 0x14); 2705648Sgblack@eecs.umich.edu 2715648Sgblack@eecs.umich.edu interrupts->setClock(tc->getCpuPtr()->ticks(16)); 2725360Sgblack@eecs.umich.edu 2735141Sgblack@eecs.umich.edu // TODO Set the SMRAM base address (SMBASE) to 0x00030000 2745141Sgblack@eecs.umich.edu 2755141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_VM_CR, 0); 2765141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_IGNNE, 0); 2775141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_SMM_CTL, 0); 2785141Sgblack@eecs.umich.edu tc->setMiscReg(MISCREG_VM_HSAVE_PA, 0); 2795135Sgblack@eecs.umich.edu} 2805135Sgblack@eecs.umich.edu 2815135Sgblack@eecs.umich.edu#endif 2825135Sgblack@eecs.umich.edu 2835234Sgblack@eecs.umich.edu#if FULL_SYSTEM 2845135Sgblack@eecs.umich.eduvoid startupCPU(ThreadContext *tc, int cpuId) 2855135Sgblack@eecs.umich.edu{ 2865135Sgblack@eecs.umich.edu if (cpuId == 0) { 2875135Sgblack@eecs.umich.edu tc->activate(0); 2885135Sgblack@eecs.umich.edu } else { 2895135Sgblack@eecs.umich.edu // This is an application processor (AP). It should be initialized to 2905135Sgblack@eecs.umich.edu // look like only the BIOS POST has run on it and put then put it into 2915135Sgblack@eecs.umich.edu // a halted state. 2925234Sgblack@eecs.umich.edu tc->suspend(); 2935135Sgblack@eecs.umich.edu } 2945135Sgblack@eecs.umich.edu} 2955135Sgblack@eecs.umich.edu 2965234Sgblack@eecs.umich.edu#else 2975234Sgblack@eecs.umich.edu 2985234Sgblack@eecs.umich.eduvoid startupCPU(ThreadContext *tc, int cpuId) 2995234Sgblack@eecs.umich.edu{ 3005234Sgblack@eecs.umich.edu tc->activate(0); 3015234Sgblack@eecs.umich.edu} 3025234Sgblack@eecs.umich.edu 3035234Sgblack@eecs.umich.edu#endif 3045234Sgblack@eecs.umich.edu 3055086Sgblack@eecs.umich.edu} //namespace X86_ISA 306