isa.cc revision 8059
111731Sjason@lowepower.com/*
211731Sjason@lowepower.com * Copyright (c) 2009 The Regents of The University of Michigan
311731Sjason@lowepower.com * All rights reserved.
411731Sjason@lowepower.com *
511731Sjason@lowepower.com * Redistribution and use in source and binary forms, with or without
611731Sjason@lowepower.com * modification, are permitted provided that the following conditions are
711731Sjason@lowepower.com * met: redistributions of source code must retain the above copyright
811731Sjason@lowepower.com * notice, this list of conditions and the following disclaimer;
911731Sjason@lowepower.com * redistributions in binary form must reproduce the above copyright
1011731Sjason@lowepower.com * notice, this list of conditions and the following disclaimer in the
1111731Sjason@lowepower.com * documentation and/or other materials provided with the distribution;
1211731Sjason@lowepower.com * neither the name of the copyright holders nor the names of its
1311731Sjason@lowepower.com * contributors may be used to endorse or promote products derived from
1411731Sjason@lowepower.com * this software without specific prior written permission.
1511731Sjason@lowepower.com *
1611731Sjason@lowepower.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1711731Sjason@lowepower.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1811731Sjason@lowepower.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1911731Sjason@lowepower.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2011731Sjason@lowepower.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2111731Sjason@lowepower.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2211731Sjason@lowepower.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2311731Sjason@lowepower.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2411731Sjason@lowepower.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2511731Sjason@lowepower.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2611731Sjason@lowepower.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2711731Sjason@lowepower.com *
2811731Sjason@lowepower.com * Authors: Gabe Black
2911731Sjason@lowepower.com */
3011731Sjason@lowepower.com
3111731Sjason@lowepower.com#include "arch/sparc/asi.hh"
3211731Sjason@lowepower.com#include "arch/sparc/isa.hh"
3311731Sjason@lowepower.com#include "base/bitfield.hh"
3411731Sjason@lowepower.com#include "base/trace.hh"
3511731Sjason@lowepower.com#include "config/full_system.hh"
3611731Sjason@lowepower.com#include "cpu/base.hh"
3711731Sjason@lowepower.com#include "cpu/thread_context.hh"
3811731Sjason@lowepower.com
3911731Sjason@lowepower.comnamespace SparcISA
4011731Sjason@lowepower.com{
4111731Sjason@lowepower.com
4211731Sjason@lowepower.comenum RegMask
4311731Sjason@lowepower.com{
4411731Sjason@lowepower.com    PSTATE_MASK = (((1 << 4) - 1) << 1) | (((1 << 4) - 1) << 6) | (1 << 12)
4511731Sjason@lowepower.com};
4611731Sjason@lowepower.com
4711731Sjason@lowepower.comvoid
4811731Sjason@lowepower.comISA::reloadRegMap()
4911731Sjason@lowepower.com{
5011731Sjason@lowepower.com    installGlobals(gl, CurrentGlobalsOffset);
5111731Sjason@lowepower.com    installWindow(cwp, CurrentWindowOffset);
5211731Sjason@lowepower.com    // Microcode registers.
5311731Sjason@lowepower.com    for (int i = 0; i < NumMicroIntRegs; i++)
5411731Sjason@lowepower.com        intRegMap[MicroIntOffset + i] = i + TotalGlobals + NWindows * 16;
5511731Sjason@lowepower.com    installGlobals(gl, NextGlobalsOffset);
5611731Sjason@lowepower.com    installWindow(cwp - 1, NextWindowOffset);
5711731Sjason@lowepower.com    installGlobals(gl, PreviousGlobalsOffset);
5811731Sjason@lowepower.com    installWindow(cwp + 1, PreviousWindowOffset);
5911731Sjason@lowepower.com}
6011731Sjason@lowepower.com
6111731Sjason@lowepower.comvoid
6211731Sjason@lowepower.comISA::installWindow(int cwp, int offset)
6311731Sjason@lowepower.com{
6411731Sjason@lowepower.com    assert(offset >= 0 && offset + NumWindowedRegs <= NumIntRegs);
6511731Sjason@lowepower.com    RegIndex *mapChunk = intRegMap + offset;
6611731Sjason@lowepower.com    for (int i = 0; i < NumWindowedRegs; i++)
6711731Sjason@lowepower.com        mapChunk[i] = TotalGlobals +
6811731Sjason@lowepower.com            ((i - cwp * RegsPerWindow + TotalWindowed) % (TotalWindowed));
6911731Sjason@lowepower.com}
7011731Sjason@lowepower.com
7111731Sjason@lowepower.comvoid
7211731Sjason@lowepower.comISA::installGlobals(int gl, int offset)
7311731Sjason@lowepower.com{
7411731Sjason@lowepower.com    assert(offset >= 0 && offset + NumGlobalRegs <= NumIntRegs);
7511731Sjason@lowepower.com    RegIndex *mapChunk = intRegMap + offset;
7611731Sjason@lowepower.com    mapChunk[0] = 0;
7711731Sjason@lowepower.com    for (int i = 1; i < NumGlobalRegs; i++)
7811731Sjason@lowepower.com        mapChunk[i] = i + gl * NumGlobalRegs;
7911731Sjason@lowepower.com}
8011731Sjason@lowepower.com
8111731Sjason@lowepower.comvoid
8211731Sjason@lowepower.comISA::clear()
8311731Sjason@lowepower.com{
8411731Sjason@lowepower.com    cwp = 0;
8511731Sjason@lowepower.com    gl = 0;
8611731Sjason@lowepower.com    reloadRegMap();
8711731Sjason@lowepower.com
8811731Sjason@lowepower.com    // y = 0;
8911731Sjason@lowepower.com    // ccr = 0;
9011731Sjason@lowepower.com    asi = 0;
9111731Sjason@lowepower.com    tick = ULL(1) << 63;
9211731Sjason@lowepower.com    fprs = 0;
9311731Sjason@lowepower.com    gsr = 0;
9411731Sjason@lowepower.com    softint = 0;
9511731Sjason@lowepower.com    tick_cmpr = 0;
9611731Sjason@lowepower.com    stick = 0;
9711731Sjason@lowepower.com    stick_cmpr = 0;
9811731Sjason@lowepower.com    memset(tpc, 0, sizeof(tpc));
9911731Sjason@lowepower.com    memset(tnpc, 0, sizeof(tnpc));
10011731Sjason@lowepower.com    memset(tstate, 0, sizeof(tstate));
10111731Sjason@lowepower.com    memset(tt, 0, sizeof(tt));
10211731Sjason@lowepower.com    tba = 0;
10311731Sjason@lowepower.com    pstate = 0;
10411731Sjason@lowepower.com    tl = 0;
10511731Sjason@lowepower.com    pil = 0;
10611731Sjason@lowepower.com    // cansave = 0;
10711731Sjason@lowepower.com    // canrestore = 0;
10811731Sjason@lowepower.com    // cleanwin = 0;
10911731Sjason@lowepower.com    // otherwin = 0;
11011731Sjason@lowepower.com    // wstate = 0;
11111731Sjason@lowepower.com    // In a T1, bit 11 is apparently always 1
11211731Sjason@lowepower.com    hpstate = (1 << 11);
11311731Sjason@lowepower.com    memset(htstate, 0, sizeof(htstate));
11411731Sjason@lowepower.com    hintp = 0;
11511731Sjason@lowepower.com    htba = 0;
11611731Sjason@lowepower.com    hstick_cmpr = 0;
11711731Sjason@lowepower.com    // This is set this way in Legion for some reason
11811731Sjason@lowepower.com    strandStatusReg = 0x50000;
11912137Sar4jc@virginia.edu    fsr = 0;
12011731Sjason@lowepower.com
12111731Sjason@lowepower.com    priContext = 0;
12211731Sjason@lowepower.com    secContext = 0;
12312137Sar4jc@virginia.edu    partId = 0;
12411731Sjason@lowepower.com    lsuCtrlReg = 0;
12511731Sjason@lowepower.com
12611731Sjason@lowepower.com    memset(scratchPad, 0, sizeof(scratchPad));
12711731Sjason@lowepower.com
12811731Sjason@lowepower.com    cpu_mondo_head = 0;
12911731Sjason@lowepower.com    cpu_mondo_tail = 0;
13011731Sjason@lowepower.com    dev_mondo_head = 0;
13111731Sjason@lowepower.com    dev_mondo_tail = 0;
13211731Sjason@lowepower.com    res_error_head = 0;
13311731Sjason@lowepower.com    res_error_tail = 0;
13411731Sjason@lowepower.com    nres_error_head = 0;
13511731Sjason@lowepower.com    nres_error_tail = 0;
13611731Sjason@lowepower.com
13711731Sjason@lowepower.com#if FULL_SYSTEM
13811731Sjason@lowepower.com    // If one of these events is active, it's not obvious to me how to get
13911731Sjason@lowepower.com    // rid of it cleanly. For now we'll just assert that they're not.
14011731Sjason@lowepower.com    if (tickCompare != NULL && sTickCompare != NULL && hSTickCompare != NULL)
14111731Sjason@lowepower.com        panic("Tick comparison event active when clearing the ISA object.\n");
14211731Sjason@lowepower.com#endif
14311731Sjason@lowepower.com}
14411731Sjason@lowepower.com
14511731Sjason@lowepower.comMiscReg
14611731Sjason@lowepower.comISA::readMiscRegNoEffect(int miscReg)
14711731Sjason@lowepower.com{
14811731Sjason@lowepower.com
14911731Sjason@lowepower.com  // The three miscRegs are moved up from the switch statement
15011731Sjason@lowepower.com  // due to more frequent calls.
15111731Sjason@lowepower.com
15211731Sjason@lowepower.com  if (miscReg == MISCREG_GL)
15311731Sjason@lowepower.com    return gl;
15411731Sjason@lowepower.com  if (miscReg == MISCREG_CWP)
15511731Sjason@lowepower.com    return cwp;
15611731Sjason@lowepower.com  if (miscReg == MISCREG_TLB_DATA) {
15711731Sjason@lowepower.com    /* Package up all the data for the tlb:
15811731Sjason@lowepower.com     * 6666555555555544444444443333333333222222222211111111110000000000
15911731Sjason@lowepower.com     * 3210987654321098765432109876543210987654321098765432109876543210
16011731Sjason@lowepower.com     *   secContext   | priContext    |             |tl|partid|  |||||^hpriv
16111731Sjason@lowepower.com     *                                                           ||||^red
16211731Sjason@lowepower.com     *                                                           |||^priv
16311731Sjason@lowepower.com     *                                                           ||^am
16411731Sjason@lowepower.com     *                                                           |^lsuim
16511731Sjason@lowepower.com     *                                                           ^lsudm
16611731Sjason@lowepower.com     */
16711731Sjason@lowepower.com    return bits((uint64_t)hpstate,2,2) |
16811731Sjason@lowepower.com           bits((uint64_t)hpstate,5,5) << 1 |
16911731Sjason@lowepower.com           bits((uint64_t)pstate,3,2) << 2 |
17011731Sjason@lowepower.com           bits((uint64_t)lsuCtrlReg,3,2) << 4 |
17111731Sjason@lowepower.com           bits((uint64_t)partId,7,0) << 8 |
17211731Sjason@lowepower.com           bits((uint64_t)tl,2,0) << 16 |
17311731Sjason@lowepower.com                (uint64_t)priContext << 32 |
17411731Sjason@lowepower.com                (uint64_t)secContext << 48;
17511731Sjason@lowepower.com  }
17611731Sjason@lowepower.com
17711731Sjason@lowepower.com    switch (miscReg) {
17811731Sjason@lowepower.com      // case MISCREG_TLB_DATA:
17911731Sjason@lowepower.com      //  [original contents see above]
18011731Sjason@lowepower.com      // case MISCREG_Y:
18111731Sjason@lowepower.com      //  return y;
18211731Sjason@lowepower.com      // case MISCREG_CCR:
18311731Sjason@lowepower.com      //  return ccr;
18411731Sjason@lowepower.com      case MISCREG_ASI:
18511731Sjason@lowepower.com        return asi;
18611731Sjason@lowepower.com      case MISCREG_FPRS:
18711731Sjason@lowepower.com        return fprs;
18811731Sjason@lowepower.com      case MISCREG_TICK:
18911731Sjason@lowepower.com        return tick;
19011731Sjason@lowepower.com      case MISCREG_PCR:
19111731Sjason@lowepower.com        panic("PCR not implemented\n");
19211731Sjason@lowepower.com      case MISCREG_PIC:
19311731Sjason@lowepower.com        panic("PIC not implemented\n");
19411731Sjason@lowepower.com      case MISCREG_GSR:
19511731Sjason@lowepower.com        return gsr;
19611731Sjason@lowepower.com      case MISCREG_SOFTINT:
19711731Sjason@lowepower.com        return softint;
19811731Sjason@lowepower.com      case MISCREG_TICK_CMPR:
19911731Sjason@lowepower.com        return tick_cmpr;
20011731Sjason@lowepower.com      case MISCREG_STICK:
20111731Sjason@lowepower.com        return stick;
20211731Sjason@lowepower.com      case MISCREG_STICK_CMPR:
20311731Sjason@lowepower.com        return stick_cmpr;
20411731Sjason@lowepower.com
20511731Sjason@lowepower.com        /** Privilged Registers */
20611731Sjason@lowepower.com      case MISCREG_TPC:
20711731Sjason@lowepower.com        return tpc[tl-1];
20811731Sjason@lowepower.com      case MISCREG_TNPC:
20911731Sjason@lowepower.com        return tnpc[tl-1];
21011731Sjason@lowepower.com      case MISCREG_TSTATE:
21111731Sjason@lowepower.com        return tstate[tl-1];
21211731Sjason@lowepower.com      case MISCREG_TT:
21311731Sjason@lowepower.com        return tt[tl-1];
21411731Sjason@lowepower.com      case MISCREG_PRIVTICK:
21511731Sjason@lowepower.com        panic("Priviliged access to tick registers not implemented\n");
21611731Sjason@lowepower.com      case MISCREG_TBA:
21711731Sjason@lowepower.com        return tba;
21811731Sjason@lowepower.com      case MISCREG_PSTATE:
21911731Sjason@lowepower.com        return pstate;
22011731Sjason@lowepower.com      case MISCREG_TL:
22111731Sjason@lowepower.com        return tl;
22211731Sjason@lowepower.com      case MISCREG_PIL:
22311731Sjason@lowepower.com        return pil;
22411731Sjason@lowepower.com      // CWP, GL moved
22511731Sjason@lowepower.com      // case MISCREG_CWP:
22611731Sjason@lowepower.com      //   return cwp;
22711731Sjason@lowepower.com      // case MISCREG_CANSAVE:
22811731Sjason@lowepower.com      //   return cansave;
22911731Sjason@lowepower.com      // case MISCREG_CANRESTORE:
23011731Sjason@lowepower.com      //   return canrestore;
23111731Sjason@lowepower.com      // case MISCREG_CLEANWIN:
23211731Sjason@lowepower.com      //   return cleanwin;
23311731Sjason@lowepower.com      // case MISCREG_OTHERWIN:
23411731Sjason@lowepower.com      //   return otherwin;
23511731Sjason@lowepower.com      // case MISCREG_WSTATE:
23611731Sjason@lowepower.com      //   return wstate;
23711731Sjason@lowepower.com      // case MISCREG_GL:
23811731Sjason@lowepower.com      //   return gl;
23911731Sjason@lowepower.com
24011731Sjason@lowepower.com        /** Hyper privileged registers */
24111731Sjason@lowepower.com      case MISCREG_HPSTATE:
24211731Sjason@lowepower.com        return hpstate;
24311731Sjason@lowepower.com      case MISCREG_HTSTATE:
24411731Sjason@lowepower.com        return htstate[tl-1];
24511731Sjason@lowepower.com      case MISCREG_HINTP:
24611731Sjason@lowepower.com        return hintp;
24711731Sjason@lowepower.com      case MISCREG_HTBA:
24811731Sjason@lowepower.com        return htba;
24911731Sjason@lowepower.com      case MISCREG_STRAND_STS_REG:
25011731Sjason@lowepower.com        return strandStatusReg;
25111731Sjason@lowepower.com      case MISCREG_HSTICK_CMPR:
25211731Sjason@lowepower.com        return hstick_cmpr;
25311731Sjason@lowepower.com
25411731Sjason@lowepower.com        /** Floating Point Status Register */
25511731Sjason@lowepower.com      case MISCREG_FSR:
25611731Sjason@lowepower.com        DPRINTF(MiscRegs, "FSR read as: %#x\n", fsr);
25711731Sjason@lowepower.com        return fsr;
25811731Sjason@lowepower.com
25911731Sjason@lowepower.com      case MISCREG_MMU_P_CONTEXT:
26011731Sjason@lowepower.com        return priContext;
26111731Sjason@lowepower.com      case MISCREG_MMU_S_CONTEXT:
26211731Sjason@lowepower.com        return secContext;
26311731Sjason@lowepower.com      case MISCREG_MMU_PART_ID:
26411731Sjason@lowepower.com        return partId;
26511731Sjason@lowepower.com      case MISCREG_MMU_LSU_CTRL:
26611731Sjason@lowepower.com        return lsuCtrlReg;
26711731Sjason@lowepower.com
26811731Sjason@lowepower.com      case MISCREG_SCRATCHPAD_R0:
26911731Sjason@lowepower.com        return scratchPad[0];
27011731Sjason@lowepower.com      case MISCREG_SCRATCHPAD_R1:
27111731Sjason@lowepower.com        return scratchPad[1];
27211731Sjason@lowepower.com      case MISCREG_SCRATCHPAD_R2:
27311731Sjason@lowepower.com        return scratchPad[2];
27411731Sjason@lowepower.com      case MISCREG_SCRATCHPAD_R3:
27511731Sjason@lowepower.com        return scratchPad[3];
27611731Sjason@lowepower.com      case MISCREG_SCRATCHPAD_R4:
27711731Sjason@lowepower.com        return scratchPad[4];
27811731Sjason@lowepower.com      case MISCREG_SCRATCHPAD_R5:
27911731Sjason@lowepower.com        return scratchPad[5];
28011731Sjason@lowepower.com      case MISCREG_SCRATCHPAD_R6:
28111731Sjason@lowepower.com        return scratchPad[6];
28211731Sjason@lowepower.com      case MISCREG_SCRATCHPAD_R7:
28311731Sjason@lowepower.com        return scratchPad[7];
28411731Sjason@lowepower.com      case MISCREG_QUEUE_CPU_MONDO_HEAD:
28511731Sjason@lowepower.com        return cpu_mondo_head;
28611731Sjason@lowepower.com      case MISCREG_QUEUE_CPU_MONDO_TAIL:
28711731Sjason@lowepower.com        return cpu_mondo_tail;
28811731Sjason@lowepower.com      case MISCREG_QUEUE_DEV_MONDO_HEAD:
28911731Sjason@lowepower.com        return dev_mondo_head;
29011731Sjason@lowepower.com      case MISCREG_QUEUE_DEV_MONDO_TAIL:
29111731Sjason@lowepower.com        return dev_mondo_tail;
29211731Sjason@lowepower.com      case MISCREG_QUEUE_RES_ERROR_HEAD:
29311731Sjason@lowepower.com        return res_error_head;
29411731Sjason@lowepower.com      case MISCREG_QUEUE_RES_ERROR_TAIL:
29511731Sjason@lowepower.com        return res_error_tail;
29611731Sjason@lowepower.com      case MISCREG_QUEUE_NRES_ERROR_HEAD:
29711731Sjason@lowepower.com        return nres_error_head;
29811731Sjason@lowepower.com      case MISCREG_QUEUE_NRES_ERROR_TAIL:
29911731Sjason@lowepower.com        return nres_error_tail;
30011731Sjason@lowepower.com      default:
30111731Sjason@lowepower.com        panic("Miscellaneous register %d not implemented\n", miscReg);
30211731Sjason@lowepower.com    }
30311731Sjason@lowepower.com}
30411731Sjason@lowepower.com
30511731Sjason@lowepower.comMiscReg
30611731Sjason@lowepower.comISA::readMiscReg(int miscReg, ThreadContext * tc)
30711731Sjason@lowepower.com{
30811731Sjason@lowepower.com    switch (miscReg) {
30911731Sjason@lowepower.com        // tick and stick are aliased to each other in niagra
31011731Sjason@lowepower.com        // well store the tick data in stick and the interrupt bit in tick
31111731Sjason@lowepower.com      case MISCREG_STICK:
31211731Sjason@lowepower.com      case MISCREG_TICK:
31311731Sjason@lowepower.com      case MISCREG_PRIVTICK:
31411731Sjason@lowepower.com        // I'm not sure why legion ignores the lowest two bits, but we'll go
31511731Sjason@lowepower.com        // with it
31611731Sjason@lowepower.com        // change from curCycle() to instCount() until we're done with legion
31711731Sjason@lowepower.com        DPRINTF(Timer, "Instruction Count when TICK read: %#X stick=%#X\n",
31811731Sjason@lowepower.com                tc->getCpuPtr()->instCount(), stick);
31911731Sjason@lowepower.com        return mbits(tc->getCpuPtr()->instCount() + (int64_t)stick,62,2) |
32011731Sjason@lowepower.com               mbits(tick,63,63);
32111731Sjason@lowepower.com      case MISCREG_FPRS:
32211731Sjason@lowepower.com        // in legion if fp is enabled du and dl are set
32311731Sjason@lowepower.com        return fprs | 0x3;
32411731Sjason@lowepower.com      case MISCREG_PCR:
32511731Sjason@lowepower.com      case MISCREG_PIC:
32611731Sjason@lowepower.com        panic("Performance Instrumentation not impl\n");
32711731Sjason@lowepower.com      case MISCREG_SOFTINT_CLR:
32811731Sjason@lowepower.com      case MISCREG_SOFTINT_SET:
32911731Sjason@lowepower.com        panic("Can read from softint clr/set\n");
33011731Sjason@lowepower.com      case MISCREG_SOFTINT:
33111731Sjason@lowepower.com      case MISCREG_TICK_CMPR:
33211731Sjason@lowepower.com      case MISCREG_STICK_CMPR:
33311731Sjason@lowepower.com      case MISCREG_HINTP:
33411731Sjason@lowepower.com      case MISCREG_HTSTATE:
33511731Sjason@lowepower.com      case MISCREG_HTBA:
33611731Sjason@lowepower.com      case MISCREG_HVER:
33711731Sjason@lowepower.com      case MISCREG_STRAND_STS_REG:
33811731Sjason@lowepower.com      case MISCREG_HSTICK_CMPR:
33911731Sjason@lowepower.com      case MISCREG_QUEUE_CPU_MONDO_HEAD:
34011731Sjason@lowepower.com      case MISCREG_QUEUE_CPU_MONDO_TAIL:
34111731Sjason@lowepower.com      case MISCREG_QUEUE_DEV_MONDO_HEAD:
34211731Sjason@lowepower.com      case MISCREG_QUEUE_DEV_MONDO_TAIL:
34311731Sjason@lowepower.com      case MISCREG_QUEUE_RES_ERROR_HEAD:
34411731Sjason@lowepower.com      case MISCREG_QUEUE_RES_ERROR_TAIL:
34511731Sjason@lowepower.com      case MISCREG_QUEUE_NRES_ERROR_HEAD:
34611731Sjason@lowepower.com      case MISCREG_QUEUE_NRES_ERROR_TAIL:
34711731Sjason@lowepower.com#if FULL_SYSTEM
34811731Sjason@lowepower.com      case MISCREG_HPSTATE:
34911731Sjason@lowepower.com        return readFSReg(miscReg, tc);
35011731Sjason@lowepower.com#else
35111731Sjason@lowepower.com      case MISCREG_HPSTATE:
35211731Sjason@lowepower.com        // HPSTATE is special because because sometimes in privilege
35311731Sjason@lowepower.com        // checks for instructions it will read HPSTATE to make sure
35411731Sjason@lowepower.com        // the priv. level is ok So, we'll just have to tell it it
35511731Sjason@lowepower.com        // isn't, instead of panicing.
35611731Sjason@lowepower.com        return 0;
35711731Sjason@lowepower.com
35811731Sjason@lowepower.com      panic("Accessing Fullsystem register %d in SE mode\n", miscReg);
35911731Sjason@lowepower.com#endif
36011731Sjason@lowepower.com
36111731Sjason@lowepower.com    }
36211731Sjason@lowepower.com    return readMiscRegNoEffect(miscReg);
36311731Sjason@lowepower.com}
36411731Sjason@lowepower.com
36511731Sjason@lowepower.comvoid
36611731Sjason@lowepower.comISA::setMiscRegNoEffect(int miscReg, MiscReg val)
36711731Sjason@lowepower.com{
36811731Sjason@lowepower.com    switch (miscReg) {
36911731Sjason@lowepower.com//      case MISCREG_Y:
37011731Sjason@lowepower.com//        y = val;
37111731Sjason@lowepower.com//        break;
37211731Sjason@lowepower.com//      case MISCREG_CCR:
37311731Sjason@lowepower.com//        ccr = val;
37411731Sjason@lowepower.com//        break;
37511731Sjason@lowepower.com      case MISCREG_ASI:
37611731Sjason@lowepower.com        asi = val;
37711731Sjason@lowepower.com        break;
37811731Sjason@lowepower.com      case MISCREG_FPRS:
37911731Sjason@lowepower.com        fprs = val;
38011731Sjason@lowepower.com        break;
38111731Sjason@lowepower.com      case MISCREG_TICK:
38211731Sjason@lowepower.com        tick = val;
38311731Sjason@lowepower.com        break;
38411731Sjason@lowepower.com      case MISCREG_PCR:
38511731Sjason@lowepower.com        panic("PCR not implemented\n");
38611731Sjason@lowepower.com      case MISCREG_PIC:
38711731Sjason@lowepower.com        panic("PIC not implemented\n");
38811731Sjason@lowepower.com      case MISCREG_GSR:
38911731Sjason@lowepower.com        gsr = val;
39011731Sjason@lowepower.com        break;
39111731Sjason@lowepower.com      case MISCREG_SOFTINT:
39211731Sjason@lowepower.com        softint = val;
39311731Sjason@lowepower.com        break;
39411731Sjason@lowepower.com      case MISCREG_TICK_CMPR:
39511731Sjason@lowepower.com        tick_cmpr = val;
39611731Sjason@lowepower.com        break;
39711731Sjason@lowepower.com      case MISCREG_STICK:
39811731Sjason@lowepower.com        stick = val;
39911731Sjason@lowepower.com        break;
40011731Sjason@lowepower.com      case MISCREG_STICK_CMPR:
40111731Sjason@lowepower.com        stick_cmpr = val;
40211731Sjason@lowepower.com        break;
40311731Sjason@lowepower.com
40411731Sjason@lowepower.com        /** Privilged Registers */
40511731Sjason@lowepower.com      case MISCREG_TPC:
40611731Sjason@lowepower.com        tpc[tl-1] = val;
40711731Sjason@lowepower.com        break;
40811731Sjason@lowepower.com      case MISCREG_TNPC:
40911731Sjason@lowepower.com        tnpc[tl-1] = val;
41011731Sjason@lowepower.com        break;
41111731Sjason@lowepower.com      case MISCREG_TSTATE:
41211731Sjason@lowepower.com        tstate[tl-1] = val;
41311731Sjason@lowepower.com        break;
41411731Sjason@lowepower.com      case MISCREG_TT:
41511731Sjason@lowepower.com        tt[tl-1] = val;
41611731Sjason@lowepower.com        break;
41711731Sjason@lowepower.com      case MISCREG_PRIVTICK:
41811731Sjason@lowepower.com        panic("Priviliged access to tick regesiters not implemented\n");
41911731Sjason@lowepower.com      case MISCREG_TBA:
42011731Sjason@lowepower.com        // clear lower 7 bits on writes.
42111731Sjason@lowepower.com        tba = val & ULL(~0x7FFF);
42211731Sjason@lowepower.com        break;
42311731Sjason@lowepower.com      case MISCREG_PSTATE:
42411731Sjason@lowepower.com        pstate = (val & PSTATE_MASK);
42511731Sjason@lowepower.com        break;
42611731Sjason@lowepower.com      case MISCREG_TL:
42711731Sjason@lowepower.com        tl = val;
42811731Sjason@lowepower.com        break;
42911731Sjason@lowepower.com      case MISCREG_PIL:
43011731Sjason@lowepower.com        pil = val;
43111731Sjason@lowepower.com        break;
43211731Sjason@lowepower.com      case MISCREG_CWP:
43311731Sjason@lowepower.com        cwp = val;
43411731Sjason@lowepower.com        break;
43511731Sjason@lowepower.com//      case MISCREG_CANSAVE:
43611731Sjason@lowepower.com//        cansave = val;
43711731Sjason@lowepower.com//        break;
43811731Sjason@lowepower.com//      case MISCREG_CANRESTORE:
43911731Sjason@lowepower.com//        canrestore = val;
44011731Sjason@lowepower.com//        break;
44111731Sjason@lowepower.com//      case MISCREG_CLEANWIN:
44211731Sjason@lowepower.com//        cleanwin = val;
44311731Sjason@lowepower.com//        break;
44411731Sjason@lowepower.com//      case MISCREG_OTHERWIN:
44511731Sjason@lowepower.com//        otherwin = val;
44611731Sjason@lowepower.com//        break;
44711731Sjason@lowepower.com//      case MISCREG_WSTATE:
44811731Sjason@lowepower.com//        wstate = val;
44911731Sjason@lowepower.com//        break;
45011731Sjason@lowepower.com      case MISCREG_GL:
45111731Sjason@lowepower.com        gl = val;
45211731Sjason@lowepower.com        break;
45311731Sjason@lowepower.com
45411731Sjason@lowepower.com        /** Hyper privileged registers */
45511731Sjason@lowepower.com      case MISCREG_HPSTATE:
45611731Sjason@lowepower.com        hpstate = val;
45711731Sjason@lowepower.com        break;
45811731Sjason@lowepower.com      case MISCREG_HTSTATE:
45911731Sjason@lowepower.com        htstate[tl-1] = val;
46011731Sjason@lowepower.com        break;
46111731Sjason@lowepower.com      case MISCREG_HINTP:
46211731Sjason@lowepower.com        hintp = val;
46311731Sjason@lowepower.com      case MISCREG_HTBA:
46411731Sjason@lowepower.com        htba = val;
46511731Sjason@lowepower.com        break;
46611731Sjason@lowepower.com      case MISCREG_STRAND_STS_REG:
46711731Sjason@lowepower.com        strandStatusReg = val;
46811731Sjason@lowepower.com        break;
46911731Sjason@lowepower.com      case MISCREG_HSTICK_CMPR:
47011731Sjason@lowepower.com        hstick_cmpr = val;
47111731Sjason@lowepower.com        break;
47211731Sjason@lowepower.com
47311731Sjason@lowepower.com        /** Floating Point Status Register */
47411731Sjason@lowepower.com      case MISCREG_FSR:
47511731Sjason@lowepower.com        fsr = val;
47611731Sjason@lowepower.com        DPRINTF(MiscRegs, "FSR written with: %#x\n", fsr);
47711731Sjason@lowepower.com        break;
47811731Sjason@lowepower.com
47911731Sjason@lowepower.com      case MISCREG_MMU_P_CONTEXT:
48011731Sjason@lowepower.com        priContext = val;
48111731Sjason@lowepower.com        break;
48211731Sjason@lowepower.com      case MISCREG_MMU_S_CONTEXT:
48311731Sjason@lowepower.com        secContext = val;
48411731Sjason@lowepower.com        break;
48511731Sjason@lowepower.com      case MISCREG_MMU_PART_ID:
48611731Sjason@lowepower.com        partId = val;
48711731Sjason@lowepower.com        break;
48811731Sjason@lowepower.com      case MISCREG_MMU_LSU_CTRL:
48911731Sjason@lowepower.com        lsuCtrlReg = val;
49011731Sjason@lowepower.com        break;
49111731Sjason@lowepower.com
49211731Sjason@lowepower.com      case MISCREG_SCRATCHPAD_R0:
49311731Sjason@lowepower.com        scratchPad[0] = val;
49411731Sjason@lowepower.com        break;
49511731Sjason@lowepower.com      case MISCREG_SCRATCHPAD_R1:
49611731Sjason@lowepower.com        scratchPad[1] = val;
49711731Sjason@lowepower.com        break;
49811731Sjason@lowepower.com      case MISCREG_SCRATCHPAD_R2:
49911731Sjason@lowepower.com        scratchPad[2] = val;
50011731Sjason@lowepower.com        break;
50111731Sjason@lowepower.com      case MISCREG_SCRATCHPAD_R3:
50211731Sjason@lowepower.com        scratchPad[3] = val;
50311731Sjason@lowepower.com        break;
50411731Sjason@lowepower.com      case MISCREG_SCRATCHPAD_R4:
50511731Sjason@lowepower.com        scratchPad[4] = val;
50611731Sjason@lowepower.com        break;
50711731Sjason@lowepower.com      case MISCREG_SCRATCHPAD_R5:
50811731Sjason@lowepower.com        scratchPad[5] = val;
50911731Sjason@lowepower.com        break;
51011731Sjason@lowepower.com      case MISCREG_SCRATCHPAD_R6:
51111731Sjason@lowepower.com        scratchPad[6] = val;
51211731Sjason@lowepower.com        break;
51311731Sjason@lowepower.com      case MISCREG_SCRATCHPAD_R7:
51411731Sjason@lowepower.com        scratchPad[7] = val;
51511731Sjason@lowepower.com        break;
51611731Sjason@lowepower.com      case MISCREG_QUEUE_CPU_MONDO_HEAD:
51711731Sjason@lowepower.com        cpu_mondo_head = val;
51811731Sjason@lowepower.com        break;
51911731Sjason@lowepower.com      case MISCREG_QUEUE_CPU_MONDO_TAIL:
52011731Sjason@lowepower.com        cpu_mondo_tail = val;
52111731Sjason@lowepower.com        break;
52211731Sjason@lowepower.com      case MISCREG_QUEUE_DEV_MONDO_HEAD:
52311731Sjason@lowepower.com        dev_mondo_head = val;
52411731Sjason@lowepower.com        break;
52511731Sjason@lowepower.com      case MISCREG_QUEUE_DEV_MONDO_TAIL:
52611731Sjason@lowepower.com        dev_mondo_tail = val;
52711731Sjason@lowepower.com        break;
52811731Sjason@lowepower.com      case MISCREG_QUEUE_RES_ERROR_HEAD:
52911731Sjason@lowepower.com        res_error_head = val;
53011731Sjason@lowepower.com        break;
53111731Sjason@lowepower.com      case MISCREG_QUEUE_RES_ERROR_TAIL:
53211731Sjason@lowepower.com        res_error_tail = val;
53311731Sjason@lowepower.com        break;
53411731Sjason@lowepower.com      case MISCREG_QUEUE_NRES_ERROR_HEAD:
53511731Sjason@lowepower.com        nres_error_head = val;
53611731Sjason@lowepower.com        break;
53711731Sjason@lowepower.com      case MISCREG_QUEUE_NRES_ERROR_TAIL:
53811731Sjason@lowepower.com        nres_error_tail = val;
53911731Sjason@lowepower.com        break;
54011731Sjason@lowepower.com      default:
54111731Sjason@lowepower.com        panic("Miscellaneous register %d not implemented\n", miscReg);
54211731Sjason@lowepower.com    }
54311731Sjason@lowepower.com}
54411731Sjason@lowepower.com
54511731Sjason@lowepower.comvoid
54611731Sjason@lowepower.comISA::setMiscReg(int miscReg, MiscReg val, ThreadContext * tc)
54711731Sjason@lowepower.com{
54811731Sjason@lowepower.com    MiscReg new_val = val;
54911731Sjason@lowepower.com
55011731Sjason@lowepower.com    switch (miscReg) {
55111731Sjason@lowepower.com      case MISCREG_STICK:
55211731Sjason@lowepower.com      case MISCREG_TICK:
55311731Sjason@lowepower.com        // stick and tick are same thing on niagra
55411731Sjason@lowepower.com        // use stick for offset and tick for holding intrrupt bit
55511731Sjason@lowepower.com        stick = mbits(val,62,0) - tc->getCpuPtr()->instCount();
55611731Sjason@lowepower.com        tick = mbits(val,63,63);
55711731Sjason@lowepower.com        DPRINTF(Timer, "Writing TICK=%#X\n", val);
55811731Sjason@lowepower.com        break;
55911731Sjason@lowepower.com      case MISCREG_FPRS:
56011731Sjason@lowepower.com        // Configure the fpu based on the fprs
56111731Sjason@lowepower.com        break;
56211731Sjason@lowepower.com      case MISCREG_PCR:
56311731Sjason@lowepower.com        // Set up performance counting based on pcr value
56411731Sjason@lowepower.com        break;
56511731Sjason@lowepower.com      case MISCREG_PSTATE:
56611731Sjason@lowepower.com        pstate = val & PSTATE_MASK;
56711731Sjason@lowepower.com        return;
56811731Sjason@lowepower.com      case MISCREG_TL:
56911731Sjason@lowepower.com        tl = val;
57011731Sjason@lowepower.com#if FULL_SYSTEM
57111731Sjason@lowepower.com        if (hpstate & HPSTATE::tlz && tl == 0 && !(hpstate & HPSTATE::hpriv))
57211731Sjason@lowepower.com            tc->getCpuPtr()->postInterrupt(IT_TRAP_LEVEL_ZERO, 0);
57311731Sjason@lowepower.com        else
57411731Sjason@lowepower.com            tc->getCpuPtr()->clearInterrupt(IT_TRAP_LEVEL_ZERO, 0);
57511731Sjason@lowepower.com#endif
57611731Sjason@lowepower.com        return;
57711731Sjason@lowepower.com      case MISCREG_CWP:
57811731Sjason@lowepower.com        new_val = val >= NWindows ? NWindows - 1 : val;
57911731Sjason@lowepower.com        if (val >= NWindows)
58011731Sjason@lowepower.com            new_val = NWindows - 1;
58111731Sjason@lowepower.com
58211731Sjason@lowepower.com        installWindow(new_val, CurrentWindowOffset);
58311731Sjason@lowepower.com        installWindow(new_val - 1, NextWindowOffset);
58411731Sjason@lowepower.com        installWindow(new_val + 1, PreviousWindowOffset);
58511731Sjason@lowepower.com        break;
58611731Sjason@lowepower.com      case MISCREG_GL:
58711731Sjason@lowepower.com        installGlobals(val, CurrentGlobalsOffset);
58811731Sjason@lowepower.com        installGlobals(val, NextGlobalsOffset);
58911731Sjason@lowepower.com        installGlobals(val, PreviousGlobalsOffset);
59011731Sjason@lowepower.com        break;
59111731Sjason@lowepower.com      case MISCREG_PIL:
59211731Sjason@lowepower.com      case MISCREG_SOFTINT:
59311731Sjason@lowepower.com      case MISCREG_SOFTINT_SET:
59411731Sjason@lowepower.com      case MISCREG_SOFTINT_CLR:
59511731Sjason@lowepower.com      case MISCREG_TICK_CMPR:
59611731Sjason@lowepower.com      case MISCREG_STICK_CMPR:
59711731Sjason@lowepower.com      case MISCREG_HINTP:
59811731Sjason@lowepower.com      case MISCREG_HTSTATE:
59911731Sjason@lowepower.com      case MISCREG_HTBA:
60011731Sjason@lowepower.com      case MISCREG_HVER:
60111731Sjason@lowepower.com      case MISCREG_STRAND_STS_REG:
60211731Sjason@lowepower.com      case MISCREG_HSTICK_CMPR:
60311731Sjason@lowepower.com      case MISCREG_QUEUE_CPU_MONDO_HEAD:
60411731Sjason@lowepower.com      case MISCREG_QUEUE_CPU_MONDO_TAIL:
60511731Sjason@lowepower.com      case MISCREG_QUEUE_DEV_MONDO_HEAD:
60611731Sjason@lowepower.com      case MISCREG_QUEUE_DEV_MONDO_TAIL:
60711731Sjason@lowepower.com      case MISCREG_QUEUE_RES_ERROR_HEAD:
60811731Sjason@lowepower.com      case MISCREG_QUEUE_RES_ERROR_TAIL:
60911731Sjason@lowepower.com      case MISCREG_QUEUE_NRES_ERROR_HEAD:
61011731Sjason@lowepower.com      case MISCREG_QUEUE_NRES_ERROR_TAIL:
61111731Sjason@lowepower.com#if FULL_SYSTEM
61211731Sjason@lowepower.com      case MISCREG_HPSTATE:
61311731Sjason@lowepower.com        setFSReg(miscReg, val, tc);
61411731Sjason@lowepower.com        return;
61511731Sjason@lowepower.com#else
61611731Sjason@lowepower.com      case MISCREG_HPSTATE:
61711731Sjason@lowepower.com        // HPSTATE is special because normal trap processing saves HPSTATE when
61811731Sjason@lowepower.com        // it goes into a trap, and restores it when it returns.
61911731Sjason@lowepower.com        return;
62011731Sjason@lowepower.com      panic("Accessing Fullsystem register %d to %#x in SE mode\n",
62111731Sjason@lowepower.com              miscReg, val);
62211731Sjason@lowepower.com#endif
62311731Sjason@lowepower.com    }
62411731Sjason@lowepower.com    setMiscRegNoEffect(miscReg, new_val);
62511731Sjason@lowepower.com}
62611731Sjason@lowepower.com
62711731Sjason@lowepower.comvoid
62811731Sjason@lowepower.comISA::serialize(EventManager *em, std::ostream &os)
62911731Sjason@lowepower.com{
63011731Sjason@lowepower.com    SERIALIZE_SCALAR(asi);
63111731Sjason@lowepower.com    SERIALIZE_SCALAR(tick);
63211731Sjason@lowepower.com    SERIALIZE_SCALAR(fprs);
63311731Sjason@lowepower.com    SERIALIZE_SCALAR(gsr);
63411731Sjason@lowepower.com    SERIALIZE_SCALAR(softint);
63511731Sjason@lowepower.com    SERIALIZE_SCALAR(tick_cmpr);
63611731Sjason@lowepower.com    SERIALIZE_SCALAR(stick);
63711731Sjason@lowepower.com    SERIALIZE_SCALAR(stick_cmpr);
63811731Sjason@lowepower.com    SERIALIZE_ARRAY(tpc,MaxTL);
63911731Sjason@lowepower.com    SERIALIZE_ARRAY(tnpc,MaxTL);
64011731Sjason@lowepower.com    SERIALIZE_ARRAY(tstate,MaxTL);
64111731Sjason@lowepower.com    SERIALIZE_ARRAY(tt,MaxTL);
64211731Sjason@lowepower.com    SERIALIZE_SCALAR(tba);
64311731Sjason@lowepower.com    SERIALIZE_SCALAR(pstate);
64411731Sjason@lowepower.com    SERIALIZE_SCALAR(tl);
64511731Sjason@lowepower.com    SERIALIZE_SCALAR(pil);
64611731Sjason@lowepower.com    SERIALIZE_SCALAR(cwp);
64711731Sjason@lowepower.com    SERIALIZE_SCALAR(gl);
64811731Sjason@lowepower.com    SERIALIZE_SCALAR(hpstate);
64911731Sjason@lowepower.com    SERIALIZE_ARRAY(htstate,MaxTL);
65011731Sjason@lowepower.com    SERIALIZE_SCALAR(hintp);
65111731Sjason@lowepower.com    SERIALIZE_SCALAR(htba);
65211731Sjason@lowepower.com    SERIALIZE_SCALAR(hstick_cmpr);
65311731Sjason@lowepower.com    SERIALIZE_SCALAR(strandStatusReg);
65411731Sjason@lowepower.com    SERIALIZE_SCALAR(fsr);
65511731Sjason@lowepower.com    SERIALIZE_SCALAR(priContext);
65611731Sjason@lowepower.com    SERIALIZE_SCALAR(secContext);
65711731Sjason@lowepower.com    SERIALIZE_SCALAR(partId);
65811731Sjason@lowepower.com    SERIALIZE_SCALAR(lsuCtrlReg);
65911731Sjason@lowepower.com    SERIALIZE_ARRAY(scratchPad,8);
66011731Sjason@lowepower.com    SERIALIZE_SCALAR(cpu_mondo_head);
66111731Sjason@lowepower.com    SERIALIZE_SCALAR(cpu_mondo_tail);
66211731Sjason@lowepower.com    SERIALIZE_SCALAR(dev_mondo_head);
66311731Sjason@lowepower.com    SERIALIZE_SCALAR(dev_mondo_tail);
66411731Sjason@lowepower.com    SERIALIZE_SCALAR(res_error_head);
66511731Sjason@lowepower.com    SERIALIZE_SCALAR(res_error_tail);
66611731Sjason@lowepower.com    SERIALIZE_SCALAR(nres_error_head);
66711731Sjason@lowepower.com    SERIALIZE_SCALAR(nres_error_tail);
66811731Sjason@lowepower.com#if FULL_SYSTEM
66911731Sjason@lowepower.com    Tick tick_cmp = 0, stick_cmp = 0, hstick_cmp = 0;
67011731Sjason@lowepower.com    ThreadContext *tc = NULL;
67111731Sjason@lowepower.com    BaseCPU *cpu = NULL;
67211731Sjason@lowepower.com    int tc_num = 0;
67311731Sjason@lowepower.com    bool tick_intr_sched = true;
67411731Sjason@lowepower.com
67511731Sjason@lowepower.com    if (tickCompare)
67611731Sjason@lowepower.com        tc = tickCompare->getTC();
67711731Sjason@lowepower.com    else if (sTickCompare)
67811731Sjason@lowepower.com        tc = sTickCompare->getTC();
67911731Sjason@lowepower.com    else if (hSTickCompare)
68011731Sjason@lowepower.com        tc = hSTickCompare->getTC();
68111731Sjason@lowepower.com    else
68211731Sjason@lowepower.com        tick_intr_sched = false;
68311731Sjason@lowepower.com
68411731Sjason@lowepower.com    SERIALIZE_SCALAR(tick_intr_sched);
68511731Sjason@lowepower.com
68611731Sjason@lowepower.com    if (tc) {
68711731Sjason@lowepower.com        cpu = tc->getCpuPtr();
68811731Sjason@lowepower.com        tc_num = cpu->findContext(tc);
68911731Sjason@lowepower.com        if (tickCompare && tickCompare->scheduled())
69011731Sjason@lowepower.com            tick_cmp = tickCompare->when();
69111731Sjason@lowepower.com        if (sTickCompare && sTickCompare->scheduled())
69211731Sjason@lowepower.com            stick_cmp = sTickCompare->when();
69311731Sjason@lowepower.com        if (hSTickCompare && hSTickCompare->scheduled())
69411731Sjason@lowepower.com            hstick_cmp = hSTickCompare->when();
69511731Sjason@lowepower.com
69611731Sjason@lowepower.com        SERIALIZE_OBJPTR(cpu);
69711731Sjason@lowepower.com        SERIALIZE_SCALAR(tc_num);
69811731Sjason@lowepower.com        SERIALIZE_SCALAR(tick_cmp);
69911731Sjason@lowepower.com        SERIALIZE_SCALAR(stick_cmp);
70011731Sjason@lowepower.com        SERIALIZE_SCALAR(hstick_cmp);
70111731Sjason@lowepower.com    }
70211731Sjason@lowepower.com#endif
70311731Sjason@lowepower.com}
70411731Sjason@lowepower.com
70511731Sjason@lowepower.comvoid
70611731Sjason@lowepower.comISA::unserialize(EventManager *em, Checkpoint *cp, const std::string &section)
70711731Sjason@lowepower.com{
70811731Sjason@lowepower.com    UNSERIALIZE_SCALAR(asi);
70911731Sjason@lowepower.com    UNSERIALIZE_SCALAR(tick);
71011731Sjason@lowepower.com    UNSERIALIZE_SCALAR(fprs);
71111731Sjason@lowepower.com    UNSERIALIZE_SCALAR(gsr);
71211731Sjason@lowepower.com    UNSERIALIZE_SCALAR(softint);
71311731Sjason@lowepower.com    UNSERIALIZE_SCALAR(tick_cmpr);
71411731Sjason@lowepower.com    UNSERIALIZE_SCALAR(stick);
71511731Sjason@lowepower.com    UNSERIALIZE_SCALAR(stick_cmpr);
71611731Sjason@lowepower.com    UNSERIALIZE_ARRAY(tpc,MaxTL);
71711731Sjason@lowepower.com    UNSERIALIZE_ARRAY(tnpc,MaxTL);
71811731Sjason@lowepower.com    UNSERIALIZE_ARRAY(tstate,MaxTL);
71911731Sjason@lowepower.com    UNSERIALIZE_ARRAY(tt,MaxTL);
72011731Sjason@lowepower.com    UNSERIALIZE_SCALAR(tba);
72111731Sjason@lowepower.com    UNSERIALIZE_SCALAR(pstate);
72211731Sjason@lowepower.com    UNSERIALIZE_SCALAR(tl);
72311731Sjason@lowepower.com    UNSERIALIZE_SCALAR(pil);
72411731Sjason@lowepower.com    UNSERIALIZE_SCALAR(cwp);
72511731Sjason@lowepower.com    UNSERIALIZE_SCALAR(gl);
72611731Sjason@lowepower.com    reloadRegMap();
72711731Sjason@lowepower.com    UNSERIALIZE_SCALAR(hpstate);
72811731Sjason@lowepower.com    UNSERIALIZE_ARRAY(htstate,MaxTL);
72911731Sjason@lowepower.com    UNSERIALIZE_SCALAR(hintp);
73011731Sjason@lowepower.com    UNSERIALIZE_SCALAR(htba);
73111731Sjason@lowepower.com    UNSERIALIZE_SCALAR(hstick_cmpr);
73211731Sjason@lowepower.com    UNSERIALIZE_SCALAR(strandStatusReg);
73311731Sjason@lowepower.com    UNSERIALIZE_SCALAR(fsr);
73411731Sjason@lowepower.com    UNSERIALIZE_SCALAR(priContext);
73511731Sjason@lowepower.com    UNSERIALIZE_SCALAR(secContext);
73611731Sjason@lowepower.com    UNSERIALIZE_SCALAR(partId);
73711731Sjason@lowepower.com    UNSERIALIZE_SCALAR(lsuCtrlReg);
73811731Sjason@lowepower.com    UNSERIALIZE_ARRAY(scratchPad,8);
73911731Sjason@lowepower.com    UNSERIALIZE_SCALAR(cpu_mondo_head);
74011731Sjason@lowepower.com    UNSERIALIZE_SCALAR(cpu_mondo_tail);
74111731Sjason@lowepower.com    UNSERIALIZE_SCALAR(dev_mondo_head);
74211731Sjason@lowepower.com    UNSERIALIZE_SCALAR(dev_mondo_tail);
74311731Sjason@lowepower.com    UNSERIALIZE_SCALAR(res_error_head);
74411731Sjason@lowepower.com    UNSERIALIZE_SCALAR(res_error_tail);
74511731Sjason@lowepower.com    UNSERIALIZE_SCALAR(nres_error_head);
74611731Sjason@lowepower.com    UNSERIALIZE_SCALAR(nres_error_tail);
74711731Sjason@lowepower.com
74811731Sjason@lowepower.com#if FULL_SYSTEM
74911731Sjason@lowepower.com    Tick tick_cmp = 0, stick_cmp = 0, hstick_cmp = 0;
75012137Sar4jc@virginia.edu    ThreadContext *tc = NULL;
75111731Sjason@lowepower.com    BaseCPU *cpu = NULL;
75211731Sjason@lowepower.com    int tc_num;
75311731Sjason@lowepower.com    bool tick_intr_sched;
75411731Sjason@lowepower.com    UNSERIALIZE_SCALAR(tick_intr_sched);
75511731Sjason@lowepower.com    if (tick_intr_sched) {
75611731Sjason@lowepower.com        UNSERIALIZE_OBJPTR(cpu);
75711731Sjason@lowepower.com        if (cpu) {
75811731Sjason@lowepower.com            UNSERIALIZE_SCALAR(tc_num);
75912137Sar4jc@virginia.edu            UNSERIALIZE_SCALAR(tick_cmp);
76011731Sjason@lowepower.com            UNSERIALIZE_SCALAR(stick_cmp);
76111731Sjason@lowepower.com            UNSERIALIZE_SCALAR(hstick_cmp);
76211731Sjason@lowepower.com            tc = cpu->getContext(tc_num);
76312137Sar4jc@virginia.edu
76411731Sjason@lowepower.com            if (tick_cmp) {
76512137Sar4jc@virginia.edu                tickCompare = new TickCompareEvent(this, tc);
76611731Sjason@lowepower.com                em->schedule(tickCompare, tick_cmp);
76712137Sar4jc@virginia.edu            }
76811731Sjason@lowepower.com            if (stick_cmp)  {
76911731Sjason@lowepower.com                sTickCompare = new STickCompareEvent(this, tc);
77011731Sjason@lowepower.com                em->schedule(sTickCompare, stick_cmp);
77111731Sjason@lowepower.com            }
77211731Sjason@lowepower.com            if (hstick_cmp)  {
77311731Sjason@lowepower.com                hSTickCompare = new HSTickCompareEvent(this, tc);
77411731Sjason@lowepower.com                em->schedule(hSTickCompare, hstick_cmp);
77511731Sjason@lowepower.com            }
77611731Sjason@lowepower.com        }
77711731Sjason@lowepower.com    }
77811731Sjason@lowepower.com
77911731Sjason@lowepower.com #endif
78011731Sjason@lowepower.com}
78111731Sjason@lowepower.com
78211731Sjason@lowepower.com}
78311731Sjason@lowepower.com