isa.cc revision 8887
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
316313Sgblack@eecs.umich.edu#include "arch/mips/isa.hh"
328229Snate@binkert.org#include "arch/mips/mt.hh"
336334Sgblack@eecs.umich.edu#include "arch/mips/mt_constants.hh"
346334Sgblack@eecs.umich.edu#include "arch/mips/pra_constants.hh"
356334Sgblack@eecs.umich.edu#include "base/bitfield.hh"
366334Sgblack@eecs.umich.edu#include "cpu/base.hh"
376313Sgblack@eecs.umich.edu#include "cpu/thread_context.hh"
388232Snate@binkert.org#include "debug/MipsPRA.hh"
396313Sgblack@eecs.umich.edu
406313Sgblack@eecs.umich.edunamespace MipsISA
416313Sgblack@eecs.umich.edu{
426313Sgblack@eecs.umich.edu
436334Sgblack@eecs.umich.edustd::string
446334Sgblack@eecs.umich.eduISA::miscRegNames[NumMiscRegs] =
456334Sgblack@eecs.umich.edu{
466334Sgblack@eecs.umich.edu    "Index", "MVPControl", "MVPConf0", "MVPConf1", "", "", "", "",
476334Sgblack@eecs.umich.edu    "Random", "VPEControl", "VPEConf0", "VPEConf1",
486334Sgblack@eecs.umich.edu        "YQMask", "VPESchedule", "VPEScheFBack", "VPEOpt",
496334Sgblack@eecs.umich.edu    "EntryLo0", "TCStatus", "TCBind", "TCRestart",
506334Sgblack@eecs.umich.edu        "TCHalt", "TCContext", "TCSchedule", "TCScheFBack",
516334Sgblack@eecs.umich.edu    "EntryLo1", "", "", "", "", "", "", "",
526334Sgblack@eecs.umich.edu    "Context", "ContextConfig", "", "", "", "", "", "",
536334Sgblack@eecs.umich.edu    "PageMask", "PageGrain", "", "", "", "", "", "",
546334Sgblack@eecs.umich.edu    "Wired", "SRSConf0", "SRCConf1", "SRSConf2",
556334Sgblack@eecs.umich.edu        "SRSConf3", "SRSConf4", "", "",
566334Sgblack@eecs.umich.edu    "HWREna", "", "", "", "", "", "", "",
576334Sgblack@eecs.umich.edu    "BadVAddr", "", "", "", "", "", "", "",
586334Sgblack@eecs.umich.edu    "Count", "", "", "", "", "", "", "",
596334Sgblack@eecs.umich.edu    "EntryHi", "", "", "", "", "", "", "",
606334Sgblack@eecs.umich.edu    "Compare", "", "", "", "", "", "", "",
616334Sgblack@eecs.umich.edu    "Status", "IntCtl", "SRSCtl", "SRSMap", "", "", "", "",
626334Sgblack@eecs.umich.edu    "Cause", "", "", "", "", "", "", "",
636334Sgblack@eecs.umich.edu    "EPC", "", "", "", "", "", "", "",
646334Sgblack@eecs.umich.edu    "PRId", "EBase", "", "", "", "", "", "",
656334Sgblack@eecs.umich.edu    "Config", "Config1", "Config2", "Config3", "", "", "", "",
666334Sgblack@eecs.umich.edu    "LLAddr", "", "", "", "", "", "", "",
676334Sgblack@eecs.umich.edu    "WatchLo0", "WatchLo1", "WatchLo2", "WatchLo3",
686334Sgblack@eecs.umich.edu        "WatchLo4", "WatchLo5", "WatchLo6", "WatchLo7",
696334Sgblack@eecs.umich.edu    "WatchHi0", "WatchHi1", "WatchHi2", "WatchHi3",
706334Sgblack@eecs.umich.edu        "WatchHi4", "WatchHi5", "WatchHi6", "WatchHi7",
716334Sgblack@eecs.umich.edu    "XCContext64", "", "", "", "", "", "", "",
726334Sgblack@eecs.umich.edu    "", "", "", "", "", "", "", "",
736334Sgblack@eecs.umich.edu    "", "", "", "", "", "", "", "",
746334Sgblack@eecs.umich.edu    "Debug", "TraceControl1", "TraceControl2", "UserTraceData",
756334Sgblack@eecs.umich.edu        "TraceBPC", "", "", "",
766334Sgblack@eecs.umich.edu    "DEPC", "", "", "", "", "", "", "",
776334Sgblack@eecs.umich.edu    "PerfCnt0", "PerfCnt1", "PerfCnt2", "PerfCnt3",
786334Sgblack@eecs.umich.edu        "PerfCnt4", "PerfCnt5", "PerfCnt6", "PerfCnt7",
796334Sgblack@eecs.umich.edu    "ErrCtl", "", "", "", "", "", "", "",
806334Sgblack@eecs.umich.edu    "CacheErr0", "CacheErr1", "CacheErr2", "CacheErr3", "", "", "", "",
816334Sgblack@eecs.umich.edu    "TagLo0", "DataLo1", "TagLo2", "DataLo3",
826334Sgblack@eecs.umich.edu        "TagLo4", "DataLo5", "TagLo6", "DataLo7",
836334Sgblack@eecs.umich.edu    "TagHi0", "DataHi1", "TagHi2", "DataHi3",
846334Sgblack@eecs.umich.edu        "TagHi4", "DataHi5", "TagHi6", "DataHi7",
856334Sgblack@eecs.umich.edu    "ErrorEPC", "", "", "", "", "", "", "",
866334Sgblack@eecs.umich.edu    "DESAVE", "", "", "", "", "", "", "",
876334Sgblack@eecs.umich.edu    "LLFlag"
886334Sgblack@eecs.umich.edu};
896334Sgblack@eecs.umich.edu
908181Sksewell@umich.eduISA::ISA(uint8_t num_threads, uint8_t num_vpes)
916334Sgblack@eecs.umich.edu{
928181Sksewell@umich.edu    numThreads = num_threads;
938181Sksewell@umich.edu    numVpes = num_vpes;
946334Sgblack@eecs.umich.edu
956334Sgblack@eecs.umich.edu    miscRegFile.resize(NumMiscRegs);
966334Sgblack@eecs.umich.edu    bankType.resize(NumMiscRegs);
976334Sgblack@eecs.umich.edu
986334Sgblack@eecs.umich.edu    for (int i=0; i < NumMiscRegs; i++) {
996334Sgblack@eecs.umich.edu        miscRegFile[i].resize(1);
1006334Sgblack@eecs.umich.edu        bankType[i] = perProcessor;
1016334Sgblack@eecs.umich.edu    }
1026334Sgblack@eecs.umich.edu
1036334Sgblack@eecs.umich.edu    miscRegFile_WriteMask.resize(NumMiscRegs);
1046334Sgblack@eecs.umich.edu
1056376Sgblack@eecs.umich.edu    for (int i = 0; i < NumMiscRegs; i++) {
1066376Sgblack@eecs.umich.edu        miscRegFile_WriteMask[i].push_back(0);
1076334Sgblack@eecs.umich.edu    }
1086334Sgblack@eecs.umich.edu
1096334Sgblack@eecs.umich.edu    // Initialize all Per-VPE regs
1106383Sgblack@eecs.umich.edu    uint32_t per_vpe_regs[] = { MISCREG_VPE_CONTROL,
1116383Sgblack@eecs.umich.edu                                MISCREG_VPE_CONF0, MISCREG_VPE_CONF1,
1126383Sgblack@eecs.umich.edu                                MISCREG_YQMASK,
1136383Sgblack@eecs.umich.edu                                MISCREG_VPE_SCHEDULE, MISCREG_VPE_SCHEFBACK,
1146383Sgblack@eecs.umich.edu                                MISCREG_VPE_OPT, MISCREG_SRS_CONF0,
1156383Sgblack@eecs.umich.edu                                MISCREG_SRS_CONF1, MISCREG_SRS_CONF2,
1166383Sgblack@eecs.umich.edu                                MISCREG_SRS_CONF3, MISCREG_SRS_CONF4,
1176383Sgblack@eecs.umich.edu                                MISCREG_EBASE
1186334Sgblack@eecs.umich.edu                              };
1196334Sgblack@eecs.umich.edu    uint32_t num_vpe_regs = sizeof(per_vpe_regs) / 4;
1206334Sgblack@eecs.umich.edu    for (int i = 0; i < num_vpe_regs; i++) {
1218181Sksewell@umich.edu        if (numVpes > 1) {
1228181Sksewell@umich.edu            miscRegFile[per_vpe_regs[i]].resize(numVpes);
1236334Sgblack@eecs.umich.edu        }
1246334Sgblack@eecs.umich.edu        bankType[per_vpe_regs[i]] = perVirtProcessor;
1256334Sgblack@eecs.umich.edu    }
1266334Sgblack@eecs.umich.edu
1276334Sgblack@eecs.umich.edu    // Initialize all Per-TC regs
1286383Sgblack@eecs.umich.edu    uint32_t per_tc_regs[] = { MISCREG_STATUS,
1296383Sgblack@eecs.umich.edu                               MISCREG_TC_STATUS, MISCREG_TC_BIND,
1306383Sgblack@eecs.umich.edu                               MISCREG_TC_RESTART, MISCREG_TC_HALT,
1316383Sgblack@eecs.umich.edu                               MISCREG_TC_CONTEXT, MISCREG_TC_SCHEDULE,
1326383Sgblack@eecs.umich.edu                               MISCREG_TC_SCHEFBACK,
1336383Sgblack@eecs.umich.edu                               MISCREG_DEBUG, MISCREG_LLADDR
1346334Sgblack@eecs.umich.edu                             };
1356334Sgblack@eecs.umich.edu    uint32_t num_tc_regs = sizeof(per_tc_regs) /  4;
1366334Sgblack@eecs.umich.edu
1376334Sgblack@eecs.umich.edu    for (int i = 0; i < num_tc_regs; i++) {
1388181Sksewell@umich.edu        miscRegFile[per_tc_regs[i]].resize(numThreads);
1396334Sgblack@eecs.umich.edu        bankType[per_tc_regs[i]] = perThreadContext;
1406334Sgblack@eecs.umich.edu    }
1416334Sgblack@eecs.umich.edu
1428181Sksewell@umich.edu    clear();
1436334Sgblack@eecs.umich.edu}
1446334Sgblack@eecs.umich.edu
1456334Sgblack@eecs.umich.eduvoid
1468181Sksewell@umich.eduISA::clear()
1478181Sksewell@umich.edu{
1488181Sksewell@umich.edu    for(int i = 0; i < NumMiscRegs; i++) {
1498181Sksewell@umich.edu        for (int j = 0; j < miscRegFile[i].size(); j++)
1508181Sksewell@umich.edu            miscRegFile[i][j] = 0;
1518181Sksewell@umich.edu
1528181Sksewell@umich.edu        for (int k = 0; k < miscRegFile_WriteMask[i].size(); k++)
1538181Sksewell@umich.edu            miscRegFile_WriteMask[i][k] = (long unsigned int)(-1);
1548181Sksewell@umich.edu    }
1558181Sksewell@umich.edu}
1568181Sksewell@umich.edu
1578181Sksewell@umich.edu
1588181Sksewell@umich.eduvoid
1598181Sksewell@umich.eduISA::configCP()
1606334Sgblack@eecs.umich.edu{
1616334Sgblack@eecs.umich.edu    DPRINTF(MipsPRA, "Resetting CP0 State with %i TCs and %i VPEs\n",
1628181Sksewell@umich.edu            numThreads, numVpes);
1636334Sgblack@eecs.umich.edu
1648181Sksewell@umich.edu    CoreSpecific cp;
1658181Sksewell@umich.edu    panic("CP state must be set before the following code is used");
1666334Sgblack@eecs.umich.edu
1676334Sgblack@eecs.umich.edu    // Do Default CP0 initialization HERE
1686334Sgblack@eecs.umich.edu
1696334Sgblack@eecs.umich.edu    // Do Initialization for MT cores here (eventually use
1706334Sgblack@eecs.umich.edu    // core_name parameter to toggle this initialization)
1716334Sgblack@eecs.umich.edu    // ===================================================
1726334Sgblack@eecs.umich.edu    DPRINTF(MipsPRA, "Initializing CP0 State.... ");
1736334Sgblack@eecs.umich.edu
1746383Sgblack@eecs.umich.edu    PRIdReg procId = readMiscRegNoEffect(MISCREG_PRID);
1756376Sgblack@eecs.umich.edu    procId.coOp = cp.CP0_PRId_CompanyOptions;
1766376Sgblack@eecs.umich.edu    procId.coId = cp.CP0_PRId_CompanyID;
1776376Sgblack@eecs.umich.edu    procId.procId = cp.CP0_PRId_ProcessorID;
1786376Sgblack@eecs.umich.edu    procId.rev = cp.CP0_PRId_Revision;
1796383Sgblack@eecs.umich.edu    setMiscRegNoEffect(MISCREG_PRID, procId);
1806376Sgblack@eecs.umich.edu
1816334Sgblack@eecs.umich.edu    // Now, create Write Mask for ProcID register
1826383Sgblack@eecs.umich.edu    MiscReg procIDMask = 0; // Read-Only register
1836383Sgblack@eecs.umich.edu    replaceBits(procIDMask, 0, 32, 0);
1846383Sgblack@eecs.umich.edu    setRegMask(MISCREG_PRID, procIDMask);
1856334Sgblack@eecs.umich.edu
1866334Sgblack@eecs.umich.edu    // Config
1876383Sgblack@eecs.umich.edu    ConfigReg cfg = readMiscRegNoEffect(MISCREG_CONFIG);
1886376Sgblack@eecs.umich.edu    cfg.be = cp.CP0_Config_BE;
1896376Sgblack@eecs.umich.edu    cfg.at = cp.CP0_Config_AT;
1906376Sgblack@eecs.umich.edu    cfg.ar = cp.CP0_Config_AR;
1916376Sgblack@eecs.umich.edu    cfg.mt = cp.CP0_Config_MT;
1926376Sgblack@eecs.umich.edu    cfg.vi = cp.CP0_Config_VI;
1936376Sgblack@eecs.umich.edu    cfg.m = 1;
1946383Sgblack@eecs.umich.edu    setMiscRegNoEffect(MISCREG_CONFIG, cfg);
1956334Sgblack@eecs.umich.edu    // Now, create Write Mask for Config register
1966334Sgblack@eecs.umich.edu    MiscReg cfg_Mask = 0x7FFF0007;
1976376Sgblack@eecs.umich.edu    replaceBits(cfg_Mask, 0, 32, 0);
1986383Sgblack@eecs.umich.edu    setRegMask(MISCREG_CONFIG, cfg_Mask);
1996334Sgblack@eecs.umich.edu
2006334Sgblack@eecs.umich.edu    // Config1
2016383Sgblack@eecs.umich.edu    Config1Reg cfg1 = readMiscRegNoEffect(MISCREG_CONFIG1);
2026376Sgblack@eecs.umich.edu    cfg1.mmuSize = cp.CP0_Config1_MMU;
2036376Sgblack@eecs.umich.edu    cfg1.is = cp.CP0_Config1_IS;
2046376Sgblack@eecs.umich.edu    cfg1.il = cp.CP0_Config1_IL;
2056376Sgblack@eecs.umich.edu    cfg1.ia = cp.CP0_Config1_IA;
2066376Sgblack@eecs.umich.edu    cfg1.ds = cp.CP0_Config1_DS;
2076376Sgblack@eecs.umich.edu    cfg1.dl = cp.CP0_Config1_DL;
2086376Sgblack@eecs.umich.edu    cfg1.da = cp.CP0_Config1_DA;
2096376Sgblack@eecs.umich.edu    cfg1.fp = cp.CP0_Config1_FP;
2106376Sgblack@eecs.umich.edu    cfg1.ep = cp.CP0_Config1_EP;
2116376Sgblack@eecs.umich.edu    cfg1.wr = cp.CP0_Config1_WR;
2126376Sgblack@eecs.umich.edu    cfg1.md = cp.CP0_Config1_MD;
2136376Sgblack@eecs.umich.edu    cfg1.c2 = cp.CP0_Config1_C2;
2146376Sgblack@eecs.umich.edu    cfg1.pc = cp.CP0_Config1_PC;
2156376Sgblack@eecs.umich.edu    cfg1.m = cp.CP0_Config1_M;
2166383Sgblack@eecs.umich.edu    setMiscRegNoEffect(MISCREG_CONFIG1, cfg1);
2176334Sgblack@eecs.umich.edu    // Now, create Write Mask for Config register
2186334Sgblack@eecs.umich.edu    MiscReg cfg1_Mask = 0; // Read Only Register
2196376Sgblack@eecs.umich.edu    replaceBits(cfg1_Mask, 0, 32, 0);
2206383Sgblack@eecs.umich.edu    setRegMask(MISCREG_CONFIG1, cfg1_Mask);
2216334Sgblack@eecs.umich.edu
2226334Sgblack@eecs.umich.edu    // Config2
2236383Sgblack@eecs.umich.edu    Config2Reg cfg2 = readMiscRegNoEffect(MISCREG_CONFIG2);
2246376Sgblack@eecs.umich.edu    cfg2.tu = cp.CP0_Config2_TU;
2256376Sgblack@eecs.umich.edu    cfg2.ts = cp.CP0_Config2_TS;
2266376Sgblack@eecs.umich.edu    cfg2.tl = cp.CP0_Config2_TL;
2276376Sgblack@eecs.umich.edu    cfg2.ta = cp.CP0_Config2_TA;
2286376Sgblack@eecs.umich.edu    cfg2.su = cp.CP0_Config2_SU;
2296376Sgblack@eecs.umich.edu    cfg2.ss = cp.CP0_Config2_SS;
2306376Sgblack@eecs.umich.edu    cfg2.sl = cp.CP0_Config2_SL;
2316376Sgblack@eecs.umich.edu    cfg2.sa = cp.CP0_Config2_SA;
2326376Sgblack@eecs.umich.edu    cfg2.m = cp.CP0_Config2_M;
2336383Sgblack@eecs.umich.edu    setMiscRegNoEffect(MISCREG_CONFIG2, cfg2);
2346334Sgblack@eecs.umich.edu    // Now, create Write Mask for Config register
2356334Sgblack@eecs.umich.edu    MiscReg cfg2_Mask = 0x7000F000; // Read Only Register
2366376Sgblack@eecs.umich.edu    replaceBits(cfg2_Mask, 0, 32, 0);
2376383Sgblack@eecs.umich.edu    setRegMask(MISCREG_CONFIG2, cfg2_Mask);
2386334Sgblack@eecs.umich.edu
2396334Sgblack@eecs.umich.edu    // Config3
2406383Sgblack@eecs.umich.edu    Config3Reg cfg3 = readMiscRegNoEffect(MISCREG_CONFIG3);
2416376Sgblack@eecs.umich.edu    cfg3.dspp = cp.CP0_Config3_DSPP;
2426376Sgblack@eecs.umich.edu    cfg3.lpa = cp.CP0_Config3_LPA;
2436376Sgblack@eecs.umich.edu    cfg3.veic = cp.CP0_Config3_VEIC;
2446376Sgblack@eecs.umich.edu    cfg3.vint = cp.CP0_Config3_VInt;
2456376Sgblack@eecs.umich.edu    cfg3.sp = cp.CP0_Config3_SP;
2466376Sgblack@eecs.umich.edu    cfg3.mt = cp.CP0_Config3_MT;
2476376Sgblack@eecs.umich.edu    cfg3.sm = cp.CP0_Config3_SM;
2486376Sgblack@eecs.umich.edu    cfg3.tl = cp.CP0_Config3_TL;
2496383Sgblack@eecs.umich.edu    setMiscRegNoEffect(MISCREG_CONFIG3, cfg3);
2506334Sgblack@eecs.umich.edu    // Now, create Write Mask for Config register
2516334Sgblack@eecs.umich.edu    MiscReg cfg3_Mask = 0; // Read Only Register
2526376Sgblack@eecs.umich.edu    replaceBits(cfg3_Mask, 0, 32, 0);
2536383Sgblack@eecs.umich.edu    setRegMask(MISCREG_CONFIG3, cfg3_Mask);
2546334Sgblack@eecs.umich.edu
2556334Sgblack@eecs.umich.edu    // EBase - CPUNum
2566383Sgblack@eecs.umich.edu    EBaseReg eBase = readMiscRegNoEffect(MISCREG_EBASE);
2576376Sgblack@eecs.umich.edu    eBase.cpuNum = cp.CP0_EBase_CPUNum;
2586376Sgblack@eecs.umich.edu    replaceBits(eBase, 31, 31, 1);
2596383Sgblack@eecs.umich.edu    setMiscRegNoEffect(MISCREG_EBASE, eBase);
2606334Sgblack@eecs.umich.edu    // Now, create Write Mask for Config register
2616334Sgblack@eecs.umich.edu    MiscReg EB_Mask = 0x3FFFF000;// Except Exception Base, the
2626334Sgblack@eecs.umich.edu                                 // entire register is read only
2636376Sgblack@eecs.umich.edu    replaceBits(EB_Mask, 0, 32, 0);
2646383Sgblack@eecs.umich.edu    setRegMask(MISCREG_EBASE, EB_Mask);
2656334Sgblack@eecs.umich.edu
2666334Sgblack@eecs.umich.edu    // SRS Control - HSS (Highest Shadow Set)
2676383Sgblack@eecs.umich.edu    SRSCtlReg scsCtl = readMiscRegNoEffect(MISCREG_SRSCTL);
2686376Sgblack@eecs.umich.edu    scsCtl.hss = cp.CP0_SrsCtl_HSS;
2696383Sgblack@eecs.umich.edu    setMiscRegNoEffect(MISCREG_SRSCTL, scsCtl);
2706334Sgblack@eecs.umich.edu    // Now, create Write Mask for the SRS Ctl register
2716334Sgblack@eecs.umich.edu    MiscReg SC_Mask = 0x0000F3C0;
2726376Sgblack@eecs.umich.edu    replaceBits(SC_Mask, 0, 32, 0);
2736383Sgblack@eecs.umich.edu    setRegMask(MISCREG_SRSCTL, SC_Mask);
2746334Sgblack@eecs.umich.edu
2756334Sgblack@eecs.umich.edu    // IntCtl - IPTI, IPPCI
2766383Sgblack@eecs.umich.edu    IntCtlReg intCtl = readMiscRegNoEffect(MISCREG_INTCTL);
2776376Sgblack@eecs.umich.edu    intCtl.ipti = cp.CP0_IntCtl_IPTI;
2786376Sgblack@eecs.umich.edu    intCtl.ippci = cp.CP0_IntCtl_IPPCI;
2796383Sgblack@eecs.umich.edu    setMiscRegNoEffect(MISCREG_INTCTL, intCtl);
2806334Sgblack@eecs.umich.edu    // Now, create Write Mask for the IntCtl register
2816334Sgblack@eecs.umich.edu    MiscReg IC_Mask = 0x000003E0;
2826376Sgblack@eecs.umich.edu    replaceBits(IC_Mask, 0, 32, 0);
2836383Sgblack@eecs.umich.edu    setRegMask(MISCREG_INTCTL, IC_Mask);
2846334Sgblack@eecs.umich.edu
2856334Sgblack@eecs.umich.edu    // Watch Hi - M - FIXME (More than 1 Watch register)
2866383Sgblack@eecs.umich.edu    WatchHiReg watchHi = readMiscRegNoEffect(MISCREG_WATCHHI0);
2876376Sgblack@eecs.umich.edu    watchHi.m = cp.CP0_WatchHi_M;
2886383Sgblack@eecs.umich.edu    setMiscRegNoEffect(MISCREG_WATCHHI0, watchHi);
2896334Sgblack@eecs.umich.edu    // Now, create Write Mask for the IntCtl register
2906334Sgblack@eecs.umich.edu    MiscReg wh_Mask = 0x7FFF0FFF;
2916376Sgblack@eecs.umich.edu    replaceBits(wh_Mask, 0, 32, 0);
2926383Sgblack@eecs.umich.edu    setRegMask(MISCREG_WATCHHI0, wh_Mask);
2936334Sgblack@eecs.umich.edu
2946334Sgblack@eecs.umich.edu    // Perf Ctr - M - FIXME (More than 1 PerfCnt Pair)
2956383Sgblack@eecs.umich.edu    PerfCntCtlReg perfCntCtl = readMiscRegNoEffect(MISCREG_PERFCNT0);
2966376Sgblack@eecs.umich.edu    perfCntCtl.m = cp.CP0_PerfCtr_M;
2976376Sgblack@eecs.umich.edu    perfCntCtl.w = cp.CP0_PerfCtr_W;
2986383Sgblack@eecs.umich.edu    setMiscRegNoEffect(MISCREG_PERFCNT0, perfCntCtl);
2996334Sgblack@eecs.umich.edu    // Now, create Write Mask for the IntCtl register
3006334Sgblack@eecs.umich.edu    MiscReg pc_Mask = 0x00007FF;
3016376Sgblack@eecs.umich.edu    replaceBits(pc_Mask, 0, 32, 0);
3026383Sgblack@eecs.umich.edu    setRegMask(MISCREG_PERFCNT0, pc_Mask);
3036334Sgblack@eecs.umich.edu
3046334Sgblack@eecs.umich.edu    // Random
3056383Sgblack@eecs.umich.edu    setMiscRegNoEffect(MISCREG_CP0_RANDOM, 63);
3066334Sgblack@eecs.umich.edu    // Now, create Write Mask for the IntCtl register
3076334Sgblack@eecs.umich.edu    MiscReg random_Mask = 0;
3086376Sgblack@eecs.umich.edu    replaceBits(random_Mask, 0, 32, 0);
3096383Sgblack@eecs.umich.edu    setRegMask(MISCREG_CP0_RANDOM, random_Mask);
3106334Sgblack@eecs.umich.edu
3116334Sgblack@eecs.umich.edu    // PageGrain
3126383Sgblack@eecs.umich.edu    PageGrainReg pageGrain = readMiscRegNoEffect(MISCREG_PAGEGRAIN);
3136376Sgblack@eecs.umich.edu    pageGrain.esp = cp.CP0_Config3_SP;
3146383Sgblack@eecs.umich.edu    setMiscRegNoEffect(MISCREG_PAGEGRAIN, pageGrain);
3156334Sgblack@eecs.umich.edu    // Now, create Write Mask for the IntCtl register
3166334Sgblack@eecs.umich.edu    MiscReg pg_Mask = 0x10000000;
3176376Sgblack@eecs.umich.edu    replaceBits(pg_Mask, 0, 32, 0);
3186383Sgblack@eecs.umich.edu    setRegMask(MISCREG_PAGEGRAIN, pg_Mask);
3196334Sgblack@eecs.umich.edu
3206334Sgblack@eecs.umich.edu    // Status
3216383Sgblack@eecs.umich.edu    StatusReg status = readMiscRegNoEffect(MISCREG_STATUS);
3226334Sgblack@eecs.umich.edu    // Only CU0 and IE are modified on a reset - everything else needs
3236334Sgblack@eecs.umich.edu    // to be controlled on a per CPU model basis
3246334Sgblack@eecs.umich.edu
3256334Sgblack@eecs.umich.edu    // Enable CP0 on reset
3266376Sgblack@eecs.umich.edu    // status.cu0 = 1;
3276334Sgblack@eecs.umich.edu
3286334Sgblack@eecs.umich.edu    // Enable ERL bit on a reset
3296376Sgblack@eecs.umich.edu    status.erl = 1;
3306376Sgblack@eecs.umich.edu    // Enable BEV bit on a reset
3316376Sgblack@eecs.umich.edu    status.bev = 1;
3326334Sgblack@eecs.umich.edu
3336383Sgblack@eecs.umich.edu    setMiscRegNoEffect(MISCREG_STATUS, status);
3346334Sgblack@eecs.umich.edu    // Now, create Write Mask for the Status register
3356334Sgblack@eecs.umich.edu    MiscReg stat_Mask = 0xFF78FF17;
3366376Sgblack@eecs.umich.edu    replaceBits(stat_Mask, 0, 32, 0);
3376383Sgblack@eecs.umich.edu    setRegMask(MISCREG_STATUS, stat_Mask);
3386334Sgblack@eecs.umich.edu
3396334Sgblack@eecs.umich.edu
3406334Sgblack@eecs.umich.edu    // MVPConf0
3416383Sgblack@eecs.umich.edu    MVPConf0Reg mvpConf0 = readMiscRegNoEffect(MISCREG_MVP_CONF0);
3426376Sgblack@eecs.umich.edu    mvpConf0.tca = 1;
3438181Sksewell@umich.edu    mvpConf0.pvpe = numVpes - 1;
3448181Sksewell@umich.edu    mvpConf0.ptc = numThreads - 1;
3456383Sgblack@eecs.umich.edu    setMiscRegNoEffect(MISCREG_MVP_CONF0, mvpConf0);
3466334Sgblack@eecs.umich.edu
3476334Sgblack@eecs.umich.edu    // VPEConf0
3486383Sgblack@eecs.umich.edu    VPEConf0Reg vpeConf0 = readMiscRegNoEffect(MISCREG_VPE_CONF0);
3496376Sgblack@eecs.umich.edu    vpeConf0.mvp = 1;
3506383Sgblack@eecs.umich.edu    setMiscRegNoEffect(MISCREG_VPE_CONF0, vpeConf0);
3516334Sgblack@eecs.umich.edu
3526334Sgblack@eecs.umich.edu    // TCBind
3538181Sksewell@umich.edu    for (ThreadID tid = 0; tid < numThreads; tid++) {
3546383Sgblack@eecs.umich.edu        TCBindReg tcBind = readMiscRegNoEffect(MISCREG_TC_BIND, tid);
3556376Sgblack@eecs.umich.edu        tcBind.curTC = tid;
3566383Sgblack@eecs.umich.edu        setMiscRegNoEffect(MISCREG_TC_BIND, tcBind, tid);
3576334Sgblack@eecs.umich.edu    }
3586334Sgblack@eecs.umich.edu    // TCHalt
3596383Sgblack@eecs.umich.edu    TCHaltReg tcHalt = readMiscRegNoEffect(MISCREG_TC_HALT);
3606376Sgblack@eecs.umich.edu    tcHalt.h = 0;
3616383Sgblack@eecs.umich.edu    setMiscRegNoEffect(MISCREG_TC_HALT, tcHalt);
3626334Sgblack@eecs.umich.edu
3636334Sgblack@eecs.umich.edu    // TCStatus
3646334Sgblack@eecs.umich.edu    // Set TCStatus Activated to 1 for the initial thread that is running
3656383Sgblack@eecs.umich.edu    TCStatusReg tcStatus = readMiscRegNoEffect(MISCREG_TC_STATUS);
3666376Sgblack@eecs.umich.edu    tcStatus.a = 1;
3676383Sgblack@eecs.umich.edu    setMiscRegNoEffect(MISCREG_TC_STATUS, tcStatus);
3686334Sgblack@eecs.umich.edu
3696334Sgblack@eecs.umich.edu    // Set Dynamically Allocatable bit to 1 for all other threads
3708181Sksewell@umich.edu    for (ThreadID tid = 1; tid < numThreads; tid++) {
3716383Sgblack@eecs.umich.edu        tcStatus = readMiscRegNoEffect(MISCREG_TC_STATUS, tid);
3726376Sgblack@eecs.umich.edu        tcStatus.da = 1;
3736383Sgblack@eecs.umich.edu        setMiscRegNoEffect(MISCREG_TC_STATUS, tcStatus, tid);
3746334Sgblack@eecs.umich.edu    }
3756334Sgblack@eecs.umich.edu
3766334Sgblack@eecs.umich.edu
3776383Sgblack@eecs.umich.edu    MiscReg mask = 0x7FFFFFFF;
3786334Sgblack@eecs.umich.edu
3796334Sgblack@eecs.umich.edu    // Now, create Write Mask for the Index register
3806383Sgblack@eecs.umich.edu    replaceBits(mask, 0, 32, 0);
3816383Sgblack@eecs.umich.edu    setRegMask(MISCREG_INDEX, mask);
3826334Sgblack@eecs.umich.edu
3836383Sgblack@eecs.umich.edu    mask = 0x3FFFFFFF;
3846383Sgblack@eecs.umich.edu    replaceBits(mask, 0, 32, 0);
3856383Sgblack@eecs.umich.edu    setRegMask(MISCREG_ENTRYLO0, mask);
3866383Sgblack@eecs.umich.edu    setRegMask(MISCREG_ENTRYLO1, mask);
3876334Sgblack@eecs.umich.edu
3886383Sgblack@eecs.umich.edu    mask = 0xFF800000;
3896383Sgblack@eecs.umich.edu    replaceBits(mask, 0, 32, 0);
3906383Sgblack@eecs.umich.edu    setRegMask(MISCREG_CONTEXT, mask);
3916334Sgblack@eecs.umich.edu
3926383Sgblack@eecs.umich.edu    mask = 0x1FFFF800;
3936383Sgblack@eecs.umich.edu    replaceBits(mask, 0, 32, 0);
3946383Sgblack@eecs.umich.edu    setRegMask(MISCREG_PAGEMASK, mask);
3956334Sgblack@eecs.umich.edu
3966383Sgblack@eecs.umich.edu    mask = 0x0;
3976383Sgblack@eecs.umich.edu    replaceBits(mask, 0, 32, 0);
3986383Sgblack@eecs.umich.edu    setRegMask(MISCREG_BADVADDR, mask);
3996383Sgblack@eecs.umich.edu    setRegMask(MISCREG_LLADDR, mask);
4006334Sgblack@eecs.umich.edu
4016383Sgblack@eecs.umich.edu    mask = 0x08C00300;
4026383Sgblack@eecs.umich.edu    replaceBits(mask, 0, 32, 0);
4036383Sgblack@eecs.umich.edu    setRegMask(MISCREG_CAUSE, mask);
4046334Sgblack@eecs.umich.edu
4056334Sgblack@eecs.umich.edu}
4066334Sgblack@eecs.umich.edu
4076334Sgblack@eecs.umich.eduinline unsigned
4086334Sgblack@eecs.umich.eduISA::getVPENum(ThreadID tid)
4096334Sgblack@eecs.umich.edu{
4106383Sgblack@eecs.umich.edu    TCBindReg tcBind = miscRegFile[MISCREG_TC_BIND][tid];
4116376Sgblack@eecs.umich.edu    return tcBind.curVPE;
4126313Sgblack@eecs.umich.edu}
4136313Sgblack@eecs.umich.edu
4146313Sgblack@eecs.umich.eduMiscReg
4156383Sgblack@eecs.umich.eduISA::readMiscRegNoEffect(int misc_reg, ThreadID tid)
4166313Sgblack@eecs.umich.edu{
4176334Sgblack@eecs.umich.edu    unsigned reg_sel = (bankType[misc_reg] == perThreadContext)
4186334Sgblack@eecs.umich.edu        ? tid : getVPENum(tid);
4196334Sgblack@eecs.umich.edu    DPRINTF(MipsPRA, "Reading CP0 Register:%u Select:%u (%s) (%lx).\n",
4206334Sgblack@eecs.umich.edu            misc_reg / 8, misc_reg % 8, miscRegNames[misc_reg],
4216334Sgblack@eecs.umich.edu            miscRegFile[misc_reg][reg_sel]);
4226334Sgblack@eecs.umich.edu    return miscRegFile[misc_reg][reg_sel];
4236313Sgblack@eecs.umich.edu}
4246313Sgblack@eecs.umich.edu
4256334Sgblack@eecs.umich.edu//@TODO: MIPS MT's register view automatically connects
4266334Sgblack@eecs.umich.edu//       Status to TCStatus depending on current thread
4276334Sgblack@eecs.umich.edu//template <class TC>
4286313Sgblack@eecs.umich.eduMiscReg
4296383Sgblack@eecs.umich.eduISA::readMiscReg(int misc_reg, ThreadContext *tc,  ThreadID tid)
4306313Sgblack@eecs.umich.edu{
4316334Sgblack@eecs.umich.edu    unsigned reg_sel = (bankType[misc_reg] == perThreadContext)
4326334Sgblack@eecs.umich.edu        ? tid : getVPENum(tid);
4336334Sgblack@eecs.umich.edu    DPRINTF(MipsPRA,
4346334Sgblack@eecs.umich.edu            "Reading CP0 Register:%u Select:%u (%s) with effect (%lx).\n",
4356334Sgblack@eecs.umich.edu            misc_reg / 8, misc_reg % 8, miscRegNames[misc_reg],
4366334Sgblack@eecs.umich.edu            miscRegFile[misc_reg][reg_sel]);
4376334Sgblack@eecs.umich.edu
4386378Sgblack@eecs.umich.edu    return miscRegFile[misc_reg][reg_sel];
4396313Sgblack@eecs.umich.edu}
4406313Sgblack@eecs.umich.edu
4416313Sgblack@eecs.umich.eduvoid
4426383Sgblack@eecs.umich.eduISA::setMiscRegNoEffect(int misc_reg, const MiscReg &val, ThreadID tid)
4436313Sgblack@eecs.umich.edu{
4446334Sgblack@eecs.umich.edu    unsigned reg_sel = (bankType[misc_reg] == perThreadContext)
4456334Sgblack@eecs.umich.edu        ? tid : getVPENum(tid);
4466334Sgblack@eecs.umich.edu    DPRINTF(MipsPRA,
4476334Sgblack@eecs.umich.edu            "[tid:%i]: Setting (direct set) CP0 Register:%u "
4486334Sgblack@eecs.umich.edu            "Select:%u (%s) to %#x.\n",
4496334Sgblack@eecs.umich.edu            tid, misc_reg / 8, misc_reg % 8, miscRegNames[misc_reg], val);
4506334Sgblack@eecs.umich.edu
4516334Sgblack@eecs.umich.edu    miscRegFile[misc_reg][reg_sel] = val;
4526313Sgblack@eecs.umich.edu}
4536313Sgblack@eecs.umich.edu
4546313Sgblack@eecs.umich.eduvoid
4556383Sgblack@eecs.umich.eduISA::setRegMask(int misc_reg, const MiscReg &val, ThreadID tid)
4566313Sgblack@eecs.umich.edu{
4576334Sgblack@eecs.umich.edu    unsigned reg_sel = (bankType[misc_reg] == perThreadContext)
4586334Sgblack@eecs.umich.edu        ? tid : getVPENum(tid);
4596334Sgblack@eecs.umich.edu    DPRINTF(MipsPRA,
4606334Sgblack@eecs.umich.edu            "[tid:%i]: Setting CP0 Register: %u Select: %u (%s) to %#x\n",
4616334Sgblack@eecs.umich.edu            tid, misc_reg / 8, misc_reg % 8, miscRegNames[misc_reg], val);
4626334Sgblack@eecs.umich.edu    miscRegFile_WriteMask[misc_reg][reg_sel] = val;
4636334Sgblack@eecs.umich.edu}
4646334Sgblack@eecs.umich.edu
4656334Sgblack@eecs.umich.edu// PROGRAMMER'S NOTES:
4666334Sgblack@eecs.umich.edu// (1) Some CP0 Registers have fields that cannot
4676334Sgblack@eecs.umich.edu// be overwritten. Make sure to handle those particular registers
4686334Sgblack@eecs.umich.edu// with care!
4696334Sgblack@eecs.umich.eduvoid
4706383Sgblack@eecs.umich.eduISA::setMiscReg(int misc_reg, const MiscReg &val,
4716334Sgblack@eecs.umich.edu                    ThreadContext *tc, ThreadID tid)
4726334Sgblack@eecs.umich.edu{
4736334Sgblack@eecs.umich.edu    int reg_sel = (bankType[misc_reg] == perThreadContext)
4746334Sgblack@eecs.umich.edu        ? tid : getVPENum(tid);
4756334Sgblack@eecs.umich.edu
4766334Sgblack@eecs.umich.edu    DPRINTF(MipsPRA,
4776334Sgblack@eecs.umich.edu            "[tid:%i]: Setting CP0 Register:%u "
4786334Sgblack@eecs.umich.edu            "Select:%u (%s) to %#x, with effect.\n",
4796334Sgblack@eecs.umich.edu            tid, misc_reg / 8, misc_reg % 8, miscRegNames[misc_reg], val);
4806334Sgblack@eecs.umich.edu
4816334Sgblack@eecs.umich.edu    MiscReg cp0_val = filterCP0Write(misc_reg, reg_sel, val);
4826334Sgblack@eecs.umich.edu
4836334Sgblack@eecs.umich.edu    miscRegFile[misc_reg][reg_sel] = cp0_val;
4846334Sgblack@eecs.umich.edu
4856806Sgblack@eecs.umich.edu    scheduleCP0Update(tc->getCpuPtr(), 1);
4866334Sgblack@eecs.umich.edu}
4876334Sgblack@eecs.umich.edu
4886334Sgblack@eecs.umich.edu/**
4896334Sgblack@eecs.umich.edu * This method doesn't need to adjust the Control Register Offset
4906334Sgblack@eecs.umich.edu * since it has already been done in the calling method
4916334Sgblack@eecs.umich.edu * (setRegWithEffect)
4926334Sgblack@eecs.umich.edu*/
4936334Sgblack@eecs.umich.eduMiscReg
4946334Sgblack@eecs.umich.eduISA::filterCP0Write(int misc_reg, int reg_sel, const MiscReg &val)
4956334Sgblack@eecs.umich.edu{
4966378Sgblack@eecs.umich.edu    MiscReg retVal = val;
4976334Sgblack@eecs.umich.edu
4986378Sgblack@eecs.umich.edu    // Mask off read-only regions
4996378Sgblack@eecs.umich.edu    retVal &= miscRegFile_WriteMask[misc_reg][reg_sel];
5006378Sgblack@eecs.umich.edu    MiscReg curVal = miscRegFile[misc_reg][reg_sel];
5016378Sgblack@eecs.umich.edu    // Mask off current alue with inverse mask (clear writeable bits)
5026378Sgblack@eecs.umich.edu    curVal &= (~miscRegFile_WriteMask[misc_reg][reg_sel]);
5036378Sgblack@eecs.umich.edu    retVal |= curVal; // Combine the two
5046378Sgblack@eecs.umich.edu    DPRINTF(MipsPRA,
5056378Sgblack@eecs.umich.edu            "filterCP0Write: Mask: %lx, Inverse Mask: %lx, write Val: %x, "
5066378Sgblack@eecs.umich.edu            "current val: %lx, written val: %x\n",
5076378Sgblack@eecs.umich.edu            miscRegFile_WriteMask[misc_reg][reg_sel],
5086378Sgblack@eecs.umich.edu            ~miscRegFile_WriteMask[misc_reg][reg_sel],
5096378Sgblack@eecs.umich.edu            val, miscRegFile[misc_reg][reg_sel], retVal);
5106378Sgblack@eecs.umich.edu    return retVal;
5116313Sgblack@eecs.umich.edu}
5126313Sgblack@eecs.umich.edu
5136313Sgblack@eecs.umich.eduvoid
5146806Sgblack@eecs.umich.eduISA::scheduleCP0Update(BaseCPU *cpu, int delay)
5156313Sgblack@eecs.umich.edu{
5166334Sgblack@eecs.umich.edu    if (!cp0Updated) {
5176334Sgblack@eecs.umich.edu        cp0Updated = true;
5186334Sgblack@eecs.umich.edu
5196334Sgblack@eecs.umich.edu        //schedule UPDATE
5206334Sgblack@eecs.umich.edu        CP0Event *cp0_event = new CP0Event(this, cpu, UpdateCP0);
5217823Ssteve.reinhardt@amd.com        cpu->schedule(cp0_event, curTick() + cpu->ticks(delay));
5226334Sgblack@eecs.umich.edu    }
5236313Sgblack@eecs.umich.edu}
5246313Sgblack@eecs.umich.edu
5256313Sgblack@eecs.umich.eduvoid
5266806Sgblack@eecs.umich.eduISA::updateCPU(BaseCPU *cpu)
5276313Sgblack@eecs.umich.edu{
5286334Sgblack@eecs.umich.edu    ///////////////////////////////////////////////////////////////////
5296334Sgblack@eecs.umich.edu    //
5306334Sgblack@eecs.umich.edu    // EVALUATE CP0 STATE FOR MIPS MT
5316334Sgblack@eecs.umich.edu    //
5326334Sgblack@eecs.umich.edu    ///////////////////////////////////////////////////////////////////
5336383Sgblack@eecs.umich.edu    MVPConf0Reg mvpConf0 = readMiscRegNoEffect(MISCREG_MVP_CONF0);
5346376Sgblack@eecs.umich.edu    ThreadID num_threads = mvpConf0.ptc + 1;
5356334Sgblack@eecs.umich.edu
5366334Sgblack@eecs.umich.edu    for (ThreadID tid = 0; tid < num_threads; tid++) {
5376383Sgblack@eecs.umich.edu        TCStatusReg tcStatus = readMiscRegNoEffect(MISCREG_TC_STATUS, tid);
5386383Sgblack@eecs.umich.edu        TCHaltReg tcHalt = readMiscRegNoEffect(MISCREG_TC_HALT, tid);
5396334Sgblack@eecs.umich.edu
5406334Sgblack@eecs.umich.edu        //@todo: add vpe/mt check here thru mvpcontrol & vpecontrol regs
5416376Sgblack@eecs.umich.edu        if (tcHalt.h == 1 || tcStatus.a == 0)  {
5426334Sgblack@eecs.umich.edu            haltThread(cpu->getContext(tid));
5436376Sgblack@eecs.umich.edu        } else if (tcHalt.h == 0 && tcStatus.a == 1) {
5446334Sgblack@eecs.umich.edu            restoreThread(cpu->getContext(tid));
5456334Sgblack@eecs.umich.edu        }
5466334Sgblack@eecs.umich.edu    }
5476334Sgblack@eecs.umich.edu
5486376Sgblack@eecs.umich.edu    num_threads = mvpConf0.ptc + 1;
5496334Sgblack@eecs.umich.edu
5506334Sgblack@eecs.umich.edu    // Toggle update flag after we finished updating
5516334Sgblack@eecs.umich.edu    cp0Updated = false;
5526334Sgblack@eecs.umich.edu}
5536334Sgblack@eecs.umich.edu
5546334Sgblack@eecs.umich.eduISA::CP0Event::CP0Event(CP0 *_cp0, BaseCPU *_cpu, CP0EventType e_type)
5556334Sgblack@eecs.umich.edu    : Event(CPU_Tick_Pri), cp0(_cp0), cpu(_cpu), cp0EventType(e_type)
5566334Sgblack@eecs.umich.edu{  }
5576334Sgblack@eecs.umich.edu
5586334Sgblack@eecs.umich.eduvoid
5596334Sgblack@eecs.umich.eduISA::CP0Event::process()
5606334Sgblack@eecs.umich.edu{
5616334Sgblack@eecs.umich.edu    switch (cp0EventType)
5626334Sgblack@eecs.umich.edu    {
5636334Sgblack@eecs.umich.edu      case UpdateCP0:
5646806Sgblack@eecs.umich.edu        cp0->updateCPU(cpu);
5656334Sgblack@eecs.umich.edu        break;
5666334Sgblack@eecs.umich.edu    }
5676334Sgblack@eecs.umich.edu}
5686334Sgblack@eecs.umich.edu
5696334Sgblack@eecs.umich.educonst char *
5706334Sgblack@eecs.umich.eduISA::CP0Event::description() const
5716334Sgblack@eecs.umich.edu{
5726334Sgblack@eecs.umich.edu    return "Coprocessor-0 event";
5736334Sgblack@eecs.umich.edu}
5746334Sgblack@eecs.umich.edu
5756334Sgblack@eecs.umich.eduvoid
5766334Sgblack@eecs.umich.eduISA::CP0Event::scheduleEvent(int delay)
5776334Sgblack@eecs.umich.edu{
5787823Ssteve.reinhardt@amd.com    cpu->reschedule(this, curTick() + cpu->ticks(delay), true);
5796334Sgblack@eecs.umich.edu}
5806334Sgblack@eecs.umich.edu
5816334Sgblack@eecs.umich.eduvoid
5826334Sgblack@eecs.umich.eduISA::CP0Event::unscheduleEvent()
5836334Sgblack@eecs.umich.edu{
5846334Sgblack@eecs.umich.edu    if (scheduled())
5856334Sgblack@eecs.umich.edu        squash();
5866313Sgblack@eecs.umich.edu}
5876313Sgblack@eecs.umich.edu
5886313Sgblack@eecs.umich.edu}
589