isa.cc revision 10461
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
316335Sgblack@eecs.umich.edu#include "arch/sparc/asi.hh"
329377Sgblack@eecs.umich.edu#include "arch/sparc/decoder.hh"
336313Sgblack@eecs.umich.edu#include "arch/sparc/isa.hh"
346335Sgblack@eecs.umich.edu#include "base/bitfield.hh"
356335Sgblack@eecs.umich.edu#include "base/trace.hh"
366335Sgblack@eecs.umich.edu#include "cpu/base.hh"
376313Sgblack@eecs.umich.edu#include "cpu/thread_context.hh"
388232Snate@binkert.org#include "debug/MiscRegs.hh"
398232Snate@binkert.org#include "debug/Timer.hh"
409384SAndreas.Sandberg@arm.com#include "params/SparcISA.hh"
416313Sgblack@eecs.umich.edu
426313Sgblack@eecs.umich.edunamespace SparcISA
436313Sgblack@eecs.umich.edu{
446313Sgblack@eecs.umich.edu
458829Sgblack@eecs.umich.edustatic PSTATE
468829Sgblack@eecs.umich.edubuildPstateMask()
476335Sgblack@eecs.umich.edu{
488829Sgblack@eecs.umich.edu    PSTATE mask = 0;
498829Sgblack@eecs.umich.edu    mask.ie = 1;
508829Sgblack@eecs.umich.edu    mask.priv = 1;
518829Sgblack@eecs.umich.edu    mask.am = 1;
528829Sgblack@eecs.umich.edu    mask.pef = 1;
538829Sgblack@eecs.umich.edu    mask.mm = 3;
548829Sgblack@eecs.umich.edu    mask.tle = 1;
558829Sgblack@eecs.umich.edu    mask.cle = 1;
568829Sgblack@eecs.umich.edu    mask.pid1 = 1;
578829Sgblack@eecs.umich.edu    return mask;
588829Sgblack@eecs.umich.edu}
598829Sgblack@eecs.umich.edu
608829Sgblack@eecs.umich.edustatic const PSTATE PstateMask = buildPstateMask();
616335Sgblack@eecs.umich.edu
629384SAndreas.Sandberg@arm.comISA::ISA(Params *p)
639384SAndreas.Sandberg@arm.com    : SimObject(p)
649384SAndreas.Sandberg@arm.com{
659384SAndreas.Sandberg@arm.com    tickCompare = NULL;
669384SAndreas.Sandberg@arm.com    sTickCompare = NULL;
679384SAndreas.Sandberg@arm.com    hSTickCompare = NULL;
689384SAndreas.Sandberg@arm.com
699384SAndreas.Sandberg@arm.com    clear();
709384SAndreas.Sandberg@arm.com}
719384SAndreas.Sandberg@arm.com
729384SAndreas.Sandberg@arm.comconst SparcISAParams *
739384SAndreas.Sandberg@arm.comISA::params() const
749384SAndreas.Sandberg@arm.com{
759384SAndreas.Sandberg@arm.com    return dynamic_cast<const Params *>(_params);
769384SAndreas.Sandberg@arm.com}
779384SAndreas.Sandberg@arm.com
786313Sgblack@eecs.umich.eduvoid
796337Sgblack@eecs.umich.eduISA::reloadRegMap()
806337Sgblack@eecs.umich.edu{
816337Sgblack@eecs.umich.edu    installGlobals(gl, CurrentGlobalsOffset);
826337Sgblack@eecs.umich.edu    installWindow(cwp, CurrentWindowOffset);
836337Sgblack@eecs.umich.edu    // Microcode registers.
846337Sgblack@eecs.umich.edu    for (int i = 0; i < NumMicroIntRegs; i++)
856337Sgblack@eecs.umich.edu        intRegMap[MicroIntOffset + i] = i + TotalGlobals + NWindows * 16;
866337Sgblack@eecs.umich.edu    installGlobals(gl, NextGlobalsOffset);
876337Sgblack@eecs.umich.edu    installWindow(cwp - 1, NextWindowOffset);
886337Sgblack@eecs.umich.edu    installGlobals(gl, PreviousGlobalsOffset);
896337Sgblack@eecs.umich.edu    installWindow(cwp + 1, PreviousWindowOffset);
906337Sgblack@eecs.umich.edu}
916337Sgblack@eecs.umich.edu
926337Sgblack@eecs.umich.eduvoid
936337Sgblack@eecs.umich.eduISA::installWindow(int cwp, int offset)
946337Sgblack@eecs.umich.edu{
956337Sgblack@eecs.umich.edu    assert(offset >= 0 && offset + NumWindowedRegs <= NumIntRegs);
966337Sgblack@eecs.umich.edu    RegIndex *mapChunk = intRegMap + offset;
976337Sgblack@eecs.umich.edu    for (int i = 0; i < NumWindowedRegs; i++)
986337Sgblack@eecs.umich.edu        mapChunk[i] = TotalGlobals +
996337Sgblack@eecs.umich.edu            ((i - cwp * RegsPerWindow + TotalWindowed) % (TotalWindowed));
1006337Sgblack@eecs.umich.edu}
1016337Sgblack@eecs.umich.edu
1026337Sgblack@eecs.umich.eduvoid
1036337Sgblack@eecs.umich.eduISA::installGlobals(int gl, int offset)
1046337Sgblack@eecs.umich.edu{
1056337Sgblack@eecs.umich.edu    assert(offset >= 0 && offset + NumGlobalRegs <= NumIntRegs);
1066337Sgblack@eecs.umich.edu    RegIndex *mapChunk = intRegMap + offset;
1076337Sgblack@eecs.umich.edu    mapChunk[0] = 0;
1086337Sgblack@eecs.umich.edu    for (int i = 1; i < NumGlobalRegs; i++)
1096337Sgblack@eecs.umich.edu        mapChunk[i] = i + gl * NumGlobalRegs;
1106337Sgblack@eecs.umich.edu}
1116337Sgblack@eecs.umich.edu
1126337Sgblack@eecs.umich.eduvoid
1136313Sgblack@eecs.umich.eduISA::clear()
1146313Sgblack@eecs.umich.edu{
1156337Sgblack@eecs.umich.edu    cwp = 0;
1166337Sgblack@eecs.umich.edu    gl = 0;
1176337Sgblack@eecs.umich.edu    reloadRegMap();
1186337Sgblack@eecs.umich.edu
1197741Sgblack@eecs.umich.edu    // y = 0;
1207741Sgblack@eecs.umich.edu    // ccr = 0;
1216335Sgblack@eecs.umich.edu    asi = 0;
1226335Sgblack@eecs.umich.edu    tick = ULL(1) << 63;
1236335Sgblack@eecs.umich.edu    fprs = 0;
1246335Sgblack@eecs.umich.edu    gsr = 0;
1256335Sgblack@eecs.umich.edu    softint = 0;
1266335Sgblack@eecs.umich.edu    tick_cmpr = 0;
1276335Sgblack@eecs.umich.edu    stick = 0;
1286335Sgblack@eecs.umich.edu    stick_cmpr = 0;
1296335Sgblack@eecs.umich.edu    memset(tpc, 0, sizeof(tpc));
1306335Sgblack@eecs.umich.edu    memset(tnpc, 0, sizeof(tnpc));
1316335Sgblack@eecs.umich.edu    memset(tstate, 0, sizeof(tstate));
1326335Sgblack@eecs.umich.edu    memset(tt, 0, sizeof(tt));
1337703Sgblack@eecs.umich.edu    tba = 0;
1346335Sgblack@eecs.umich.edu    pstate = 0;
1356335Sgblack@eecs.umich.edu    tl = 0;
1366335Sgblack@eecs.umich.edu    pil = 0;
1377741Sgblack@eecs.umich.edu    // cansave = 0;
1387741Sgblack@eecs.umich.edu    // canrestore = 0;
1397741Sgblack@eecs.umich.edu    // cleanwin = 0;
1407741Sgblack@eecs.umich.edu    // otherwin = 0;
1417741Sgblack@eecs.umich.edu    // wstate = 0;
1427741Sgblack@eecs.umich.edu    // In a T1, bit 11 is apparently always 1
1438829Sgblack@eecs.umich.edu    hpstate = 0;
1448829Sgblack@eecs.umich.edu    hpstate.id = 1;
1456335Sgblack@eecs.umich.edu    memset(htstate, 0, sizeof(htstate));
1466335Sgblack@eecs.umich.edu    hintp = 0;
1476335Sgblack@eecs.umich.edu    htba = 0;
1486335Sgblack@eecs.umich.edu    hstick_cmpr = 0;
1497741Sgblack@eecs.umich.edu    // This is set this way in Legion for some reason
1506335Sgblack@eecs.umich.edu    strandStatusReg = 0x50000;
1516335Sgblack@eecs.umich.edu    fsr = 0;
1526335Sgblack@eecs.umich.edu
1536335Sgblack@eecs.umich.edu    priContext = 0;
1546335Sgblack@eecs.umich.edu    secContext = 0;
1556335Sgblack@eecs.umich.edu    partId = 0;
1566335Sgblack@eecs.umich.edu    lsuCtrlReg = 0;
1576335Sgblack@eecs.umich.edu
1586335Sgblack@eecs.umich.edu    memset(scratchPad, 0, sizeof(scratchPad));
1597703Sgblack@eecs.umich.edu
1607703Sgblack@eecs.umich.edu    cpu_mondo_head = 0;
1617703Sgblack@eecs.umich.edu    cpu_mondo_tail = 0;
1627703Sgblack@eecs.umich.edu    dev_mondo_head = 0;
1637703Sgblack@eecs.umich.edu    dev_mondo_tail = 0;
1647703Sgblack@eecs.umich.edu    res_error_head = 0;
1657703Sgblack@eecs.umich.edu    res_error_tail = 0;
1667703Sgblack@eecs.umich.edu    nres_error_head = 0;
1677703Sgblack@eecs.umich.edu    nres_error_tail = 0;
1687703Sgblack@eecs.umich.edu
1697703Sgblack@eecs.umich.edu    // If one of these events is active, it's not obvious to me how to get
1707703Sgblack@eecs.umich.edu    // rid of it cleanly. For now we'll just assert that they're not.
1717703Sgblack@eecs.umich.edu    if (tickCompare != NULL && sTickCompare != NULL && hSTickCompare != NULL)
1727703Sgblack@eecs.umich.edu        panic("Tick comparison event active when clearing the ISA object.\n");
1736313Sgblack@eecs.umich.edu}
1746313Sgblack@eecs.umich.edu
1756313Sgblack@eecs.umich.eduMiscReg
1766313Sgblack@eecs.umich.eduISA::readMiscRegNoEffect(int miscReg)
1776313Sgblack@eecs.umich.edu{
1786335Sgblack@eecs.umich.edu
1796335Sgblack@eecs.umich.edu  // The three miscRegs are moved up from the switch statement
1806335Sgblack@eecs.umich.edu  // due to more frequent calls.
1816335Sgblack@eecs.umich.edu
1826335Sgblack@eecs.umich.edu  if (miscReg == MISCREG_GL)
1836335Sgblack@eecs.umich.edu    return gl;
1846335Sgblack@eecs.umich.edu  if (miscReg == MISCREG_CWP)
1856335Sgblack@eecs.umich.edu    return cwp;
1866335Sgblack@eecs.umich.edu  if (miscReg == MISCREG_TLB_DATA) {
1876335Sgblack@eecs.umich.edu    /* Package up all the data for the tlb:
1886335Sgblack@eecs.umich.edu     * 6666555555555544444444443333333333222222222211111111110000000000
1896335Sgblack@eecs.umich.edu     * 3210987654321098765432109876543210987654321098765432109876543210
1906335Sgblack@eecs.umich.edu     *   secContext   | priContext    |             |tl|partid|  |||||^hpriv
1916335Sgblack@eecs.umich.edu     *                                                           ||||^red
1926335Sgblack@eecs.umich.edu     *                                                           |||^priv
1936335Sgblack@eecs.umich.edu     *                                                           ||^am
1946335Sgblack@eecs.umich.edu     *                                                           |^lsuim
1956335Sgblack@eecs.umich.edu     *                                                           ^lsudm
1966335Sgblack@eecs.umich.edu     */
1978829Sgblack@eecs.umich.edu    return      (uint64_t)hpstate.hpriv |
1988829Sgblack@eecs.umich.edu                (uint64_t)hpstate.red << 1 |
1998829Sgblack@eecs.umich.edu                (uint64_t)pstate.priv << 2 |
2008829Sgblack@eecs.umich.edu                (uint64_t)pstate.am << 3 |
2016335Sgblack@eecs.umich.edu           bits((uint64_t)lsuCtrlReg,3,2) << 4 |
2026335Sgblack@eecs.umich.edu           bits((uint64_t)partId,7,0) << 8 |
2036335Sgblack@eecs.umich.edu           bits((uint64_t)tl,2,0) << 16 |
2046335Sgblack@eecs.umich.edu                (uint64_t)priContext << 32 |
2056335Sgblack@eecs.umich.edu                (uint64_t)secContext << 48;
2066335Sgblack@eecs.umich.edu  }
2076335Sgblack@eecs.umich.edu
2086335Sgblack@eecs.umich.edu    switch (miscReg) {
2097741Sgblack@eecs.umich.edu      // case MISCREG_TLB_DATA:
2106335Sgblack@eecs.umich.edu      //  [original contents see above]
2117741Sgblack@eecs.umich.edu      // case MISCREG_Y:
2126335Sgblack@eecs.umich.edu      //  return y;
2137741Sgblack@eecs.umich.edu      // case MISCREG_CCR:
2146335Sgblack@eecs.umich.edu      //  return ccr;
2156335Sgblack@eecs.umich.edu      case MISCREG_ASI:
2166335Sgblack@eecs.umich.edu        return asi;
2176335Sgblack@eecs.umich.edu      case MISCREG_FPRS:
2186335Sgblack@eecs.umich.edu        return fprs;
2196335Sgblack@eecs.umich.edu      case MISCREG_TICK:
2206335Sgblack@eecs.umich.edu        return tick;
2216335Sgblack@eecs.umich.edu      case MISCREG_PCR:
2226335Sgblack@eecs.umich.edu        panic("PCR not implemented\n");
2236335Sgblack@eecs.umich.edu      case MISCREG_PIC:
2246335Sgblack@eecs.umich.edu        panic("PIC not implemented\n");
2256335Sgblack@eecs.umich.edu      case MISCREG_GSR:
2266335Sgblack@eecs.umich.edu        return gsr;
2276335Sgblack@eecs.umich.edu      case MISCREG_SOFTINT:
2286335Sgblack@eecs.umich.edu        return softint;
2296335Sgblack@eecs.umich.edu      case MISCREG_TICK_CMPR:
2306335Sgblack@eecs.umich.edu        return tick_cmpr;
2316335Sgblack@eecs.umich.edu      case MISCREG_STICK:
2326335Sgblack@eecs.umich.edu        return stick;
2336335Sgblack@eecs.umich.edu      case MISCREG_STICK_CMPR:
2346335Sgblack@eecs.umich.edu        return stick_cmpr;
2356335Sgblack@eecs.umich.edu
2366335Sgblack@eecs.umich.edu        /** Privilged Registers */
2376335Sgblack@eecs.umich.edu      case MISCREG_TPC:
2386335Sgblack@eecs.umich.edu        return tpc[tl-1];
2396335Sgblack@eecs.umich.edu      case MISCREG_TNPC:
2406335Sgblack@eecs.umich.edu        return tnpc[tl-1];
2416335Sgblack@eecs.umich.edu      case MISCREG_TSTATE:
2426335Sgblack@eecs.umich.edu        return tstate[tl-1];
2436335Sgblack@eecs.umich.edu      case MISCREG_TT:
2446335Sgblack@eecs.umich.edu        return tt[tl-1];
2456335Sgblack@eecs.umich.edu      case MISCREG_PRIVTICK:
2466335Sgblack@eecs.umich.edu        panic("Priviliged access to tick registers not implemented\n");
2476335Sgblack@eecs.umich.edu      case MISCREG_TBA:
2486335Sgblack@eecs.umich.edu        return tba;
2496335Sgblack@eecs.umich.edu      case MISCREG_PSTATE:
2508829Sgblack@eecs.umich.edu        return (MiscReg)pstate;
2516335Sgblack@eecs.umich.edu      case MISCREG_TL:
2526335Sgblack@eecs.umich.edu        return tl;
2536335Sgblack@eecs.umich.edu      case MISCREG_PIL:
2546335Sgblack@eecs.umich.edu        return pil;
2557741Sgblack@eecs.umich.edu      // CWP, GL moved
2567741Sgblack@eecs.umich.edu      // case MISCREG_CWP:
2577741Sgblack@eecs.umich.edu      //   return cwp;
2587741Sgblack@eecs.umich.edu      // case MISCREG_CANSAVE:
2597741Sgblack@eecs.umich.edu      //   return cansave;
2607741Sgblack@eecs.umich.edu      // case MISCREG_CANRESTORE:
2617741Sgblack@eecs.umich.edu      //   return canrestore;
2627741Sgblack@eecs.umich.edu      // case MISCREG_CLEANWIN:
2637741Sgblack@eecs.umich.edu      //   return cleanwin;
2647741Sgblack@eecs.umich.edu      // case MISCREG_OTHERWIN:
2657741Sgblack@eecs.umich.edu      //   return otherwin;
2667741Sgblack@eecs.umich.edu      // case MISCREG_WSTATE:
2677741Sgblack@eecs.umich.edu      //   return wstate;
2687741Sgblack@eecs.umich.edu      // case MISCREG_GL:
2697741Sgblack@eecs.umich.edu      //   return gl;
2706335Sgblack@eecs.umich.edu
2716335Sgblack@eecs.umich.edu        /** Hyper privileged registers */
2726335Sgblack@eecs.umich.edu      case MISCREG_HPSTATE:
2738829Sgblack@eecs.umich.edu        return (MiscReg)hpstate;
2746335Sgblack@eecs.umich.edu      case MISCREG_HTSTATE:
2756335Sgblack@eecs.umich.edu        return htstate[tl-1];
2766335Sgblack@eecs.umich.edu      case MISCREG_HINTP:
2776335Sgblack@eecs.umich.edu        return hintp;
2786335Sgblack@eecs.umich.edu      case MISCREG_HTBA:
2796335Sgblack@eecs.umich.edu        return htba;
2806335Sgblack@eecs.umich.edu      case MISCREG_STRAND_STS_REG:
2816335Sgblack@eecs.umich.edu        return strandStatusReg;
2826335Sgblack@eecs.umich.edu      case MISCREG_HSTICK_CMPR:
2836335Sgblack@eecs.umich.edu        return hstick_cmpr;
2846335Sgblack@eecs.umich.edu
2856335Sgblack@eecs.umich.edu        /** Floating Point Status Register */
2866335Sgblack@eecs.umich.edu      case MISCREG_FSR:
2876335Sgblack@eecs.umich.edu        DPRINTF(MiscRegs, "FSR read as: %#x\n", fsr);
2886335Sgblack@eecs.umich.edu        return fsr;
2896335Sgblack@eecs.umich.edu
2906335Sgblack@eecs.umich.edu      case MISCREG_MMU_P_CONTEXT:
2916335Sgblack@eecs.umich.edu        return priContext;
2926335Sgblack@eecs.umich.edu      case MISCREG_MMU_S_CONTEXT:
2936335Sgblack@eecs.umich.edu        return secContext;
2946335Sgblack@eecs.umich.edu      case MISCREG_MMU_PART_ID:
2956335Sgblack@eecs.umich.edu        return partId;
2966335Sgblack@eecs.umich.edu      case MISCREG_MMU_LSU_CTRL:
2976335Sgblack@eecs.umich.edu        return lsuCtrlReg;
2986335Sgblack@eecs.umich.edu
2996335Sgblack@eecs.umich.edu      case MISCREG_SCRATCHPAD_R0:
3006335Sgblack@eecs.umich.edu        return scratchPad[0];
3016335Sgblack@eecs.umich.edu      case MISCREG_SCRATCHPAD_R1:
3026335Sgblack@eecs.umich.edu        return scratchPad[1];
3036335Sgblack@eecs.umich.edu      case MISCREG_SCRATCHPAD_R2:
3046335Sgblack@eecs.umich.edu        return scratchPad[2];
3056335Sgblack@eecs.umich.edu      case MISCREG_SCRATCHPAD_R3:
3066335Sgblack@eecs.umich.edu        return scratchPad[3];
3076335Sgblack@eecs.umich.edu      case MISCREG_SCRATCHPAD_R4:
3086335Sgblack@eecs.umich.edu        return scratchPad[4];
3096335Sgblack@eecs.umich.edu      case MISCREG_SCRATCHPAD_R5:
3106335Sgblack@eecs.umich.edu        return scratchPad[5];
3116335Sgblack@eecs.umich.edu      case MISCREG_SCRATCHPAD_R6:
3126335Sgblack@eecs.umich.edu        return scratchPad[6];
3136335Sgblack@eecs.umich.edu      case MISCREG_SCRATCHPAD_R7:
3146335Sgblack@eecs.umich.edu        return scratchPad[7];
3156335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_CPU_MONDO_HEAD:
3166335Sgblack@eecs.umich.edu        return cpu_mondo_head;
3176335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_CPU_MONDO_TAIL:
3186335Sgblack@eecs.umich.edu        return cpu_mondo_tail;
3196335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_DEV_MONDO_HEAD:
3206335Sgblack@eecs.umich.edu        return dev_mondo_head;
3216335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_DEV_MONDO_TAIL:
3226335Sgblack@eecs.umich.edu        return dev_mondo_tail;
3236335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_RES_ERROR_HEAD:
3246335Sgblack@eecs.umich.edu        return res_error_head;
3256335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_RES_ERROR_TAIL:
3266335Sgblack@eecs.umich.edu        return res_error_tail;
3276335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_NRES_ERROR_HEAD:
3286335Sgblack@eecs.umich.edu        return nres_error_head;
3296335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_NRES_ERROR_TAIL:
3306335Sgblack@eecs.umich.edu        return nres_error_tail;
3316335Sgblack@eecs.umich.edu      default:
3326335Sgblack@eecs.umich.edu        panic("Miscellaneous register %d not implemented\n", miscReg);
3336335Sgblack@eecs.umich.edu    }
3346313Sgblack@eecs.umich.edu}
3356313Sgblack@eecs.umich.edu
3366313Sgblack@eecs.umich.eduMiscReg
3376335Sgblack@eecs.umich.eduISA::readMiscReg(int miscReg, ThreadContext * tc)
3386313Sgblack@eecs.umich.edu{
3396335Sgblack@eecs.umich.edu    switch (miscReg) {
3406335Sgblack@eecs.umich.edu        // tick and stick are aliased to each other in niagra
3416335Sgblack@eecs.umich.edu        // well store the tick data in stick and the interrupt bit in tick
3426335Sgblack@eecs.umich.edu      case MISCREG_STICK:
3436335Sgblack@eecs.umich.edu      case MISCREG_TICK:
3446335Sgblack@eecs.umich.edu      case MISCREG_PRIVTICK:
3456335Sgblack@eecs.umich.edu        // I'm not sure why legion ignores the lowest two bits, but we'll go
3466335Sgblack@eecs.umich.edu        // with it
3476335Sgblack@eecs.umich.edu        // change from curCycle() to instCount() until we're done with legion
3486335Sgblack@eecs.umich.edu        DPRINTF(Timer, "Instruction Count when TICK read: %#X stick=%#X\n",
3496335Sgblack@eecs.umich.edu                tc->getCpuPtr()->instCount(), stick);
3506335Sgblack@eecs.umich.edu        return mbits(tc->getCpuPtr()->instCount() + (int64_t)stick,62,2) |
3516335Sgblack@eecs.umich.edu               mbits(tick,63,63);
3526335Sgblack@eecs.umich.edu      case MISCREG_FPRS:
3536335Sgblack@eecs.umich.edu        // in legion if fp is enabled du and dl are set
3546335Sgblack@eecs.umich.edu        return fprs | 0x3;
3556335Sgblack@eecs.umich.edu      case MISCREG_PCR:
3566335Sgblack@eecs.umich.edu      case MISCREG_PIC:
3576335Sgblack@eecs.umich.edu        panic("Performance Instrumentation not impl\n");
3586335Sgblack@eecs.umich.edu      case MISCREG_SOFTINT_CLR:
3596335Sgblack@eecs.umich.edu      case MISCREG_SOFTINT_SET:
3606335Sgblack@eecs.umich.edu        panic("Can read from softint clr/set\n");
3616335Sgblack@eecs.umich.edu      case MISCREG_SOFTINT:
3626335Sgblack@eecs.umich.edu      case MISCREG_TICK_CMPR:
3636335Sgblack@eecs.umich.edu      case MISCREG_STICK_CMPR:
3646335Sgblack@eecs.umich.edu      case MISCREG_HINTP:
3656335Sgblack@eecs.umich.edu      case MISCREG_HTSTATE:
3666335Sgblack@eecs.umich.edu      case MISCREG_HTBA:
3676335Sgblack@eecs.umich.edu      case MISCREG_HVER:
3686335Sgblack@eecs.umich.edu      case MISCREG_STRAND_STS_REG:
3696335Sgblack@eecs.umich.edu      case MISCREG_HSTICK_CMPR:
3706335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_CPU_MONDO_HEAD:
3716335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_CPU_MONDO_TAIL:
3726335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_DEV_MONDO_HEAD:
3736335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_DEV_MONDO_TAIL:
3746335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_RES_ERROR_HEAD:
3756335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_RES_ERROR_TAIL:
3766335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_NRES_ERROR_HEAD:
3776335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_NRES_ERROR_TAIL:
3786335Sgblack@eecs.umich.edu      case MISCREG_HPSTATE:
3796335Sgblack@eecs.umich.edu        return readFSReg(miscReg, tc);
3806335Sgblack@eecs.umich.edu    }
3816335Sgblack@eecs.umich.edu    return readMiscRegNoEffect(miscReg);
3826313Sgblack@eecs.umich.edu}
3836313Sgblack@eecs.umich.edu
3846313Sgblack@eecs.umich.eduvoid
3856335Sgblack@eecs.umich.eduISA::setMiscRegNoEffect(int miscReg, MiscReg val)
3866313Sgblack@eecs.umich.edu{
3876335Sgblack@eecs.umich.edu    switch (miscReg) {
3886335Sgblack@eecs.umich.edu//      case MISCREG_Y:
3896335Sgblack@eecs.umich.edu//        y = val;
3906335Sgblack@eecs.umich.edu//        break;
3916335Sgblack@eecs.umich.edu//      case MISCREG_CCR:
3926335Sgblack@eecs.umich.edu//        ccr = val;
3936335Sgblack@eecs.umich.edu//        break;
3946335Sgblack@eecs.umich.edu      case MISCREG_ASI:
3956335Sgblack@eecs.umich.edu        asi = val;
3966335Sgblack@eecs.umich.edu        break;
3976335Sgblack@eecs.umich.edu      case MISCREG_FPRS:
3986335Sgblack@eecs.umich.edu        fprs = val;
3996335Sgblack@eecs.umich.edu        break;
4006335Sgblack@eecs.umich.edu      case MISCREG_TICK:
4016335Sgblack@eecs.umich.edu        tick = val;
4026335Sgblack@eecs.umich.edu        break;
4036335Sgblack@eecs.umich.edu      case MISCREG_PCR:
4046335Sgblack@eecs.umich.edu        panic("PCR not implemented\n");
4056335Sgblack@eecs.umich.edu      case MISCREG_PIC:
4066335Sgblack@eecs.umich.edu        panic("PIC not implemented\n");
4076335Sgblack@eecs.umich.edu      case MISCREG_GSR:
4086335Sgblack@eecs.umich.edu        gsr = val;
4096335Sgblack@eecs.umich.edu        break;
4106335Sgblack@eecs.umich.edu      case MISCREG_SOFTINT:
4116335Sgblack@eecs.umich.edu        softint = val;
4126335Sgblack@eecs.umich.edu        break;
4136335Sgblack@eecs.umich.edu      case MISCREG_TICK_CMPR:
4146335Sgblack@eecs.umich.edu        tick_cmpr = val;
4156335Sgblack@eecs.umich.edu        break;
4166335Sgblack@eecs.umich.edu      case MISCREG_STICK:
4176335Sgblack@eecs.umich.edu        stick = val;
4186335Sgblack@eecs.umich.edu        break;
4196335Sgblack@eecs.umich.edu      case MISCREG_STICK_CMPR:
4206335Sgblack@eecs.umich.edu        stick_cmpr = val;
4216335Sgblack@eecs.umich.edu        break;
4226335Sgblack@eecs.umich.edu
4236335Sgblack@eecs.umich.edu        /** Privilged Registers */
4246335Sgblack@eecs.umich.edu      case MISCREG_TPC:
4256335Sgblack@eecs.umich.edu        tpc[tl-1] = val;
4266335Sgblack@eecs.umich.edu        break;
4276335Sgblack@eecs.umich.edu      case MISCREG_TNPC:
4286335Sgblack@eecs.umich.edu        tnpc[tl-1] = val;
4296335Sgblack@eecs.umich.edu        break;
4306335Sgblack@eecs.umich.edu      case MISCREG_TSTATE:
4316335Sgblack@eecs.umich.edu        tstate[tl-1] = val;
4326335Sgblack@eecs.umich.edu        break;
4336335Sgblack@eecs.umich.edu      case MISCREG_TT:
4346335Sgblack@eecs.umich.edu        tt[tl-1] = val;
4356335Sgblack@eecs.umich.edu        break;
4366335Sgblack@eecs.umich.edu      case MISCREG_PRIVTICK:
4376335Sgblack@eecs.umich.edu        panic("Priviliged access to tick regesiters not implemented\n");
4386335Sgblack@eecs.umich.edu      case MISCREG_TBA:
4396335Sgblack@eecs.umich.edu        // clear lower 7 bits on writes.
4406335Sgblack@eecs.umich.edu        tba = val & ULL(~0x7FFF);
4416335Sgblack@eecs.umich.edu        break;
4426335Sgblack@eecs.umich.edu      case MISCREG_PSTATE:
4438829Sgblack@eecs.umich.edu        pstate = (val & PstateMask);
4446335Sgblack@eecs.umich.edu        break;
4456335Sgblack@eecs.umich.edu      case MISCREG_TL:
4466335Sgblack@eecs.umich.edu        tl = val;
4476335Sgblack@eecs.umich.edu        break;
4486335Sgblack@eecs.umich.edu      case MISCREG_PIL:
4496335Sgblack@eecs.umich.edu        pil = val;
4506335Sgblack@eecs.umich.edu        break;
4516335Sgblack@eecs.umich.edu      case MISCREG_CWP:
4526335Sgblack@eecs.umich.edu        cwp = val;
4536335Sgblack@eecs.umich.edu        break;
4546335Sgblack@eecs.umich.edu//      case MISCREG_CANSAVE:
4556335Sgblack@eecs.umich.edu//        cansave = val;
4566335Sgblack@eecs.umich.edu//        break;
4576335Sgblack@eecs.umich.edu//      case MISCREG_CANRESTORE:
4586335Sgblack@eecs.umich.edu//        canrestore = val;
4596335Sgblack@eecs.umich.edu//        break;
4606335Sgblack@eecs.umich.edu//      case MISCREG_CLEANWIN:
4616335Sgblack@eecs.umich.edu//        cleanwin = val;
4626335Sgblack@eecs.umich.edu//        break;
4636335Sgblack@eecs.umich.edu//      case MISCREG_OTHERWIN:
4646335Sgblack@eecs.umich.edu//        otherwin = val;
4656335Sgblack@eecs.umich.edu//        break;
4666335Sgblack@eecs.umich.edu//      case MISCREG_WSTATE:
4676335Sgblack@eecs.umich.edu//        wstate = val;
4686335Sgblack@eecs.umich.edu//        break;
4696335Sgblack@eecs.umich.edu      case MISCREG_GL:
4706335Sgblack@eecs.umich.edu        gl = val;
4716335Sgblack@eecs.umich.edu        break;
4726335Sgblack@eecs.umich.edu
4736335Sgblack@eecs.umich.edu        /** Hyper privileged registers */
4746335Sgblack@eecs.umich.edu      case MISCREG_HPSTATE:
4756335Sgblack@eecs.umich.edu        hpstate = val;
4766335Sgblack@eecs.umich.edu        break;
4776335Sgblack@eecs.umich.edu      case MISCREG_HTSTATE:
4786335Sgblack@eecs.umich.edu        htstate[tl-1] = val;
4796335Sgblack@eecs.umich.edu        break;
4806335Sgblack@eecs.umich.edu      case MISCREG_HINTP:
4816335Sgblack@eecs.umich.edu        hintp = val;
4826335Sgblack@eecs.umich.edu      case MISCREG_HTBA:
4836335Sgblack@eecs.umich.edu        htba = val;
4846335Sgblack@eecs.umich.edu        break;
4856335Sgblack@eecs.umich.edu      case MISCREG_STRAND_STS_REG:
4866335Sgblack@eecs.umich.edu        strandStatusReg = val;
4876335Sgblack@eecs.umich.edu        break;
4886335Sgblack@eecs.umich.edu      case MISCREG_HSTICK_CMPR:
4896335Sgblack@eecs.umich.edu        hstick_cmpr = val;
4906335Sgblack@eecs.umich.edu        break;
4916335Sgblack@eecs.umich.edu
4926335Sgblack@eecs.umich.edu        /** Floating Point Status Register */
4936335Sgblack@eecs.umich.edu      case MISCREG_FSR:
4946335Sgblack@eecs.umich.edu        fsr = val;
4956335Sgblack@eecs.umich.edu        DPRINTF(MiscRegs, "FSR written with: %#x\n", fsr);
4966335Sgblack@eecs.umich.edu        break;
4976335Sgblack@eecs.umich.edu
4986335Sgblack@eecs.umich.edu      case MISCREG_MMU_P_CONTEXT:
4996335Sgblack@eecs.umich.edu        priContext = val;
5006335Sgblack@eecs.umich.edu        break;
5016335Sgblack@eecs.umich.edu      case MISCREG_MMU_S_CONTEXT:
5026335Sgblack@eecs.umich.edu        secContext = val;
5036335Sgblack@eecs.umich.edu        break;
5046335Sgblack@eecs.umich.edu      case MISCREG_MMU_PART_ID:
5056335Sgblack@eecs.umich.edu        partId = val;
5066335Sgblack@eecs.umich.edu        break;
5076335Sgblack@eecs.umich.edu      case MISCREG_MMU_LSU_CTRL:
5086335Sgblack@eecs.umich.edu        lsuCtrlReg = val;
5096335Sgblack@eecs.umich.edu        break;
5106335Sgblack@eecs.umich.edu
5116335Sgblack@eecs.umich.edu      case MISCREG_SCRATCHPAD_R0:
5126335Sgblack@eecs.umich.edu        scratchPad[0] = val;
5136335Sgblack@eecs.umich.edu        break;
5146335Sgblack@eecs.umich.edu      case MISCREG_SCRATCHPAD_R1:
5156335Sgblack@eecs.umich.edu        scratchPad[1] = val;
5166335Sgblack@eecs.umich.edu        break;
5176335Sgblack@eecs.umich.edu      case MISCREG_SCRATCHPAD_R2:
5186335Sgblack@eecs.umich.edu        scratchPad[2] = val;
5196335Sgblack@eecs.umich.edu        break;
5206335Sgblack@eecs.umich.edu      case MISCREG_SCRATCHPAD_R3:
5216335Sgblack@eecs.umich.edu        scratchPad[3] = val;
5226335Sgblack@eecs.umich.edu        break;
5236335Sgblack@eecs.umich.edu      case MISCREG_SCRATCHPAD_R4:
5246335Sgblack@eecs.umich.edu        scratchPad[4] = val;
5256335Sgblack@eecs.umich.edu        break;
5266335Sgblack@eecs.umich.edu      case MISCREG_SCRATCHPAD_R5:
5276335Sgblack@eecs.umich.edu        scratchPad[5] = val;
5286335Sgblack@eecs.umich.edu        break;
5296335Sgblack@eecs.umich.edu      case MISCREG_SCRATCHPAD_R6:
5306335Sgblack@eecs.umich.edu        scratchPad[6] = val;
5316335Sgblack@eecs.umich.edu        break;
5326335Sgblack@eecs.umich.edu      case MISCREG_SCRATCHPAD_R7:
5336335Sgblack@eecs.umich.edu        scratchPad[7] = val;
5346335Sgblack@eecs.umich.edu        break;
5356335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_CPU_MONDO_HEAD:
5366335Sgblack@eecs.umich.edu        cpu_mondo_head = val;
5376335Sgblack@eecs.umich.edu        break;
5386335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_CPU_MONDO_TAIL:
5396335Sgblack@eecs.umich.edu        cpu_mondo_tail = val;
5406335Sgblack@eecs.umich.edu        break;
5416335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_DEV_MONDO_HEAD:
5426335Sgblack@eecs.umich.edu        dev_mondo_head = val;
5436335Sgblack@eecs.umich.edu        break;
5446335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_DEV_MONDO_TAIL:
5456335Sgblack@eecs.umich.edu        dev_mondo_tail = val;
5466335Sgblack@eecs.umich.edu        break;
5476335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_RES_ERROR_HEAD:
5486335Sgblack@eecs.umich.edu        res_error_head = val;
5496335Sgblack@eecs.umich.edu        break;
5506335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_RES_ERROR_TAIL:
5516335Sgblack@eecs.umich.edu        res_error_tail = val;
5526335Sgblack@eecs.umich.edu        break;
5536335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_NRES_ERROR_HEAD:
5546335Sgblack@eecs.umich.edu        nres_error_head = val;
5556335Sgblack@eecs.umich.edu        break;
5566335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_NRES_ERROR_TAIL:
5576335Sgblack@eecs.umich.edu        nres_error_tail = val;
5586335Sgblack@eecs.umich.edu        break;
5596335Sgblack@eecs.umich.edu      default:
5606335Sgblack@eecs.umich.edu        panic("Miscellaneous register %d not implemented\n", miscReg);
5616335Sgblack@eecs.umich.edu    }
5626313Sgblack@eecs.umich.edu}
5636313Sgblack@eecs.umich.edu
5646313Sgblack@eecs.umich.eduvoid
5656335Sgblack@eecs.umich.eduISA::setMiscReg(int miscReg, MiscReg val, ThreadContext * tc)
5666313Sgblack@eecs.umich.edu{
5676335Sgblack@eecs.umich.edu    MiscReg new_val = val;
5686335Sgblack@eecs.umich.edu
5696335Sgblack@eecs.umich.edu    switch (miscReg) {
5709375Sgblack@eecs.umich.edu      case MISCREG_ASI:
5719377Sgblack@eecs.umich.edu        tc->getDecoderPtr()->setContext(val);
5729375Sgblack@eecs.umich.edu        break;
5736335Sgblack@eecs.umich.edu      case MISCREG_STICK:
5746335Sgblack@eecs.umich.edu      case MISCREG_TICK:
5756335Sgblack@eecs.umich.edu        // stick and tick are same thing on niagra
5766335Sgblack@eecs.umich.edu        // use stick for offset and tick for holding intrrupt bit
5776335Sgblack@eecs.umich.edu        stick = mbits(val,62,0) - tc->getCpuPtr()->instCount();
5786335Sgblack@eecs.umich.edu        tick = mbits(val,63,63);
5796335Sgblack@eecs.umich.edu        DPRINTF(Timer, "Writing TICK=%#X\n", val);
5806335Sgblack@eecs.umich.edu        break;
5816335Sgblack@eecs.umich.edu      case MISCREG_FPRS:
5827741Sgblack@eecs.umich.edu        // Configure the fpu based on the fprs
5836335Sgblack@eecs.umich.edu        break;
5846335Sgblack@eecs.umich.edu      case MISCREG_PCR:
5857741Sgblack@eecs.umich.edu        // Set up performance counting based on pcr value
5866335Sgblack@eecs.umich.edu        break;
5876335Sgblack@eecs.umich.edu      case MISCREG_PSTATE:
5888829Sgblack@eecs.umich.edu        pstate = val & PstateMask;
5896335Sgblack@eecs.umich.edu        return;
5906335Sgblack@eecs.umich.edu      case MISCREG_TL:
5918829Sgblack@eecs.umich.edu        {
5928829Sgblack@eecs.umich.edu            tl = val;
5938829Sgblack@eecs.umich.edu            if (hpstate.tlz && tl == 0 && !hpstate.hpriv)
5948829Sgblack@eecs.umich.edu                tc->getCpuPtr()->postInterrupt(IT_TRAP_LEVEL_ZERO, 0);
5958829Sgblack@eecs.umich.edu            else
5968829Sgblack@eecs.umich.edu                tc->getCpuPtr()->clearInterrupt(IT_TRAP_LEVEL_ZERO, 0);
5978829Sgblack@eecs.umich.edu            return;
5988829Sgblack@eecs.umich.edu        }
5996335Sgblack@eecs.umich.edu      case MISCREG_CWP:
6006335Sgblack@eecs.umich.edu        new_val = val >= NWindows ? NWindows - 1 : val;
6016335Sgblack@eecs.umich.edu        if (val >= NWindows)
6026335Sgblack@eecs.umich.edu            new_val = NWindows - 1;
6036337Sgblack@eecs.umich.edu
6046337Sgblack@eecs.umich.edu        installWindow(new_val, CurrentWindowOffset);
6056337Sgblack@eecs.umich.edu        installWindow(new_val - 1, NextWindowOffset);
6066337Sgblack@eecs.umich.edu        installWindow(new_val + 1, PreviousWindowOffset);
6076335Sgblack@eecs.umich.edu        break;
6086335Sgblack@eecs.umich.edu      case MISCREG_GL:
6096337Sgblack@eecs.umich.edu        installGlobals(val, CurrentGlobalsOffset);
6106337Sgblack@eecs.umich.edu        installGlobals(val, NextGlobalsOffset);
6116337Sgblack@eecs.umich.edu        installGlobals(val, PreviousGlobalsOffset);
6126335Sgblack@eecs.umich.edu        break;
6136335Sgblack@eecs.umich.edu      case MISCREG_PIL:
6146335Sgblack@eecs.umich.edu      case MISCREG_SOFTINT:
6156335Sgblack@eecs.umich.edu      case MISCREG_SOFTINT_SET:
6166335Sgblack@eecs.umich.edu      case MISCREG_SOFTINT_CLR:
6176335Sgblack@eecs.umich.edu      case MISCREG_TICK_CMPR:
6186335Sgblack@eecs.umich.edu      case MISCREG_STICK_CMPR:
6196335Sgblack@eecs.umich.edu      case MISCREG_HINTP:
6206335Sgblack@eecs.umich.edu      case MISCREG_HTSTATE:
6216335Sgblack@eecs.umich.edu      case MISCREG_HTBA:
6226335Sgblack@eecs.umich.edu      case MISCREG_HVER:
6236335Sgblack@eecs.umich.edu      case MISCREG_STRAND_STS_REG:
6246335Sgblack@eecs.umich.edu      case MISCREG_HSTICK_CMPR:
6256335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_CPU_MONDO_HEAD:
6266335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_CPU_MONDO_TAIL:
6276335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_DEV_MONDO_HEAD:
6286335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_DEV_MONDO_TAIL:
6296335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_RES_ERROR_HEAD:
6306335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_RES_ERROR_TAIL:
6316335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_NRES_ERROR_HEAD:
6326335Sgblack@eecs.umich.edu      case MISCREG_QUEUE_NRES_ERROR_TAIL:
6336335Sgblack@eecs.umich.edu      case MISCREG_HPSTATE:
6346335Sgblack@eecs.umich.edu        setFSReg(miscReg, val, tc);
6356335Sgblack@eecs.umich.edu        return;
6366335Sgblack@eecs.umich.edu    }
6376335Sgblack@eecs.umich.edu    setMiscRegNoEffect(miscReg, new_val);
6386335Sgblack@eecs.umich.edu}
6396335Sgblack@eecs.umich.edu
6406335Sgblack@eecs.umich.eduvoid
6419425SAndreas.Sandberg@ARM.comISA::serialize(std::ostream &os)
6426335Sgblack@eecs.umich.edu{
6436335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(asi);
6446335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(tick);
6456335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(fprs);
6466335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(gsr);
6476335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(softint);
6486335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(tick_cmpr);
6496335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(stick);
6506335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(stick_cmpr);
6516335Sgblack@eecs.umich.edu    SERIALIZE_ARRAY(tpc,MaxTL);
6526335Sgblack@eecs.umich.edu    SERIALIZE_ARRAY(tnpc,MaxTL);
6536335Sgblack@eecs.umich.edu    SERIALIZE_ARRAY(tstate,MaxTL);
6546335Sgblack@eecs.umich.edu    SERIALIZE_ARRAY(tt,MaxTL);
6556335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(tba);
6568829Sgblack@eecs.umich.edu    SERIALIZE_SCALAR((uint16_t)pstate);
6576335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(tl);
6586335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(pil);
6596335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(cwp);
6606335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(gl);
6618829Sgblack@eecs.umich.edu    SERIALIZE_SCALAR((uint64_t)hpstate);
6626335Sgblack@eecs.umich.edu    SERIALIZE_ARRAY(htstate,MaxTL);
6636335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(hintp);
6646335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(htba);
6656335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(hstick_cmpr);
6666335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(strandStatusReg);
6676335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(fsr);
6686335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(priContext);
6696335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(secContext);
6706335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(partId);
6716335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(lsuCtrlReg);
6726335Sgblack@eecs.umich.edu    SERIALIZE_ARRAY(scratchPad,8);
6736335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(cpu_mondo_head);
6746335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(cpu_mondo_tail);
6756335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(dev_mondo_head);
6766335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(dev_mondo_tail);
6776335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(res_error_head);
6786335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(res_error_tail);
6796335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(nres_error_head);
6806335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(nres_error_tail);
6816335Sgblack@eecs.umich.edu    Tick tick_cmp = 0, stick_cmp = 0, hstick_cmp = 0;
6826335Sgblack@eecs.umich.edu    ThreadContext *tc = NULL;
6836335Sgblack@eecs.umich.edu    BaseCPU *cpu = NULL;
6846335Sgblack@eecs.umich.edu    int tc_num = 0;
6856335Sgblack@eecs.umich.edu    bool tick_intr_sched = true;
6866335Sgblack@eecs.umich.edu
6876335Sgblack@eecs.umich.edu    if (tickCompare)
6886335Sgblack@eecs.umich.edu        tc = tickCompare->getTC();
6896335Sgblack@eecs.umich.edu    else if (sTickCompare)
6906335Sgblack@eecs.umich.edu        tc = sTickCompare->getTC();
6916335Sgblack@eecs.umich.edu    else if (hSTickCompare)
6926335Sgblack@eecs.umich.edu        tc = hSTickCompare->getTC();
6936335Sgblack@eecs.umich.edu    else
6946335Sgblack@eecs.umich.edu        tick_intr_sched = false;
6956335Sgblack@eecs.umich.edu
6966335Sgblack@eecs.umich.edu    SERIALIZE_SCALAR(tick_intr_sched);
6976335Sgblack@eecs.umich.edu
6986335Sgblack@eecs.umich.edu    if (tc) {
6996335Sgblack@eecs.umich.edu        cpu = tc->getCpuPtr();
7006335Sgblack@eecs.umich.edu        tc_num = cpu->findContext(tc);
7016335Sgblack@eecs.umich.edu        if (tickCompare && tickCompare->scheduled())
7026335Sgblack@eecs.umich.edu            tick_cmp = tickCompare->when();
7036335Sgblack@eecs.umich.edu        if (sTickCompare && sTickCompare->scheduled())
7046335Sgblack@eecs.umich.edu            stick_cmp = sTickCompare->when();
7056335Sgblack@eecs.umich.edu        if (hSTickCompare && hSTickCompare->scheduled())
7066335Sgblack@eecs.umich.edu            hstick_cmp = hSTickCompare->when();
7076335Sgblack@eecs.umich.edu
7086335Sgblack@eecs.umich.edu        SERIALIZE_OBJPTR(cpu);
7096335Sgblack@eecs.umich.edu        SERIALIZE_SCALAR(tc_num);
7106335Sgblack@eecs.umich.edu        SERIALIZE_SCALAR(tick_cmp);
7116335Sgblack@eecs.umich.edu        SERIALIZE_SCALAR(stick_cmp);
7126335Sgblack@eecs.umich.edu        SERIALIZE_SCALAR(hstick_cmp);
7136335Sgblack@eecs.umich.edu    }
7146335Sgblack@eecs.umich.edu}
7156335Sgblack@eecs.umich.edu
7166335Sgblack@eecs.umich.eduvoid
7179425SAndreas.Sandberg@ARM.comISA::unserialize(Checkpoint *cp, const std::string &section)
7186335Sgblack@eecs.umich.edu{
7196335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(asi);
7206335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(tick);
7216335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(fprs);
7226335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(gsr);
7236335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(softint);
7246335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(tick_cmpr);
7256335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(stick);
7266335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(stick_cmpr);
7276335Sgblack@eecs.umich.edu    UNSERIALIZE_ARRAY(tpc,MaxTL);
7286335Sgblack@eecs.umich.edu    UNSERIALIZE_ARRAY(tnpc,MaxTL);
7296335Sgblack@eecs.umich.edu    UNSERIALIZE_ARRAY(tstate,MaxTL);
7306335Sgblack@eecs.umich.edu    UNSERIALIZE_ARRAY(tt,MaxTL);
7316335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(tba);
7328829Sgblack@eecs.umich.edu    {
7338829Sgblack@eecs.umich.edu        uint16_t pstate;
7348829Sgblack@eecs.umich.edu        UNSERIALIZE_SCALAR(pstate);
7358829Sgblack@eecs.umich.edu        this->pstate = pstate;
7368829Sgblack@eecs.umich.edu    }
7376335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(tl);
7386335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(pil);
7396335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(cwp);
7406335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(gl);
7416337Sgblack@eecs.umich.edu    reloadRegMap();
7428829Sgblack@eecs.umich.edu    {
7438829Sgblack@eecs.umich.edu        uint64_t hpstate;
7448829Sgblack@eecs.umich.edu        UNSERIALIZE_SCALAR(hpstate);
7458829Sgblack@eecs.umich.edu        this->hpstate = hpstate;
7468829Sgblack@eecs.umich.edu    }
7476335Sgblack@eecs.umich.edu    UNSERIALIZE_ARRAY(htstate,MaxTL);
7486335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(hintp);
7496335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(htba);
7506335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(hstick_cmpr);
7516335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(strandStatusReg);
7526335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(fsr);
7536335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(priContext);
7546335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(secContext);
7556335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(partId);
7566335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(lsuCtrlReg);
7576335Sgblack@eecs.umich.edu    UNSERIALIZE_ARRAY(scratchPad,8);
7586335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(cpu_mondo_head);
7596335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(cpu_mondo_tail);
7606335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(dev_mondo_head);
7616335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(dev_mondo_tail);
7626335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(res_error_head);
7636335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(res_error_tail);
7646335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(nres_error_head);
7656335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(nres_error_tail);
7666335Sgblack@eecs.umich.edu
7676335Sgblack@eecs.umich.edu    Tick tick_cmp = 0, stick_cmp = 0, hstick_cmp = 0;
7686335Sgblack@eecs.umich.edu    ThreadContext *tc = NULL;
7696335Sgblack@eecs.umich.edu    BaseCPU *cpu = NULL;
7706335Sgblack@eecs.umich.edu    int tc_num;
7716335Sgblack@eecs.umich.edu    bool tick_intr_sched;
7726335Sgblack@eecs.umich.edu    UNSERIALIZE_SCALAR(tick_intr_sched);
7736335Sgblack@eecs.umich.edu    if (tick_intr_sched) {
7746335Sgblack@eecs.umich.edu        UNSERIALIZE_OBJPTR(cpu);
7756335Sgblack@eecs.umich.edu        if (cpu) {
7766335Sgblack@eecs.umich.edu            UNSERIALIZE_SCALAR(tc_num);
7776335Sgblack@eecs.umich.edu            UNSERIALIZE_SCALAR(tick_cmp);
7786335Sgblack@eecs.umich.edu            UNSERIALIZE_SCALAR(stick_cmp);
7796335Sgblack@eecs.umich.edu            UNSERIALIZE_SCALAR(hstick_cmp);
7806335Sgblack@eecs.umich.edu            tc = cpu->getContext(tc_num);
7816335Sgblack@eecs.umich.edu
7826335Sgblack@eecs.umich.edu            if (tick_cmp) {
7836335Sgblack@eecs.umich.edu                tickCompare = new TickCompareEvent(this, tc);
7849425SAndreas.Sandberg@ARM.com                schedule(tickCompare, tick_cmp);
7856335Sgblack@eecs.umich.edu            }
7866335Sgblack@eecs.umich.edu            if (stick_cmp)  {
7876335Sgblack@eecs.umich.edu                sTickCompare = new STickCompareEvent(this, tc);
7889425SAndreas.Sandberg@ARM.com                schedule(sTickCompare, stick_cmp);
7896335Sgblack@eecs.umich.edu            }
7906335Sgblack@eecs.umich.edu            if (hstick_cmp)  {
7916335Sgblack@eecs.umich.edu                hSTickCompare = new HSTickCompareEvent(this, tc);
7929425SAndreas.Sandberg@ARM.com                schedule(hSTickCompare, hstick_cmp);
7936335Sgblack@eecs.umich.edu            }
7946335Sgblack@eecs.umich.edu        }
7956335Sgblack@eecs.umich.edu    }
7966335Sgblack@eecs.umich.edu
7976313Sgblack@eecs.umich.edu}
7986313Sgblack@eecs.umich.edu
7996313Sgblack@eecs.umich.edu}
8009384SAndreas.Sandberg@arm.com
8019384SAndreas.Sandberg@arm.comSparcISA::ISA *
8029384SAndreas.Sandberg@arm.comSparcISAParams::create()
8039384SAndreas.Sandberg@arm.com{
8049384SAndreas.Sandberg@arm.com    return new SparcISA::ISA(this);
8059384SAndreas.Sandberg@arm.com}
806