isa.cc revision 9050
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" 326313Sgblack@eecs.umich.edu#include "arch/sparc/isa.hh" 336335Sgblack@eecs.umich.edu#include "base/bitfield.hh" 346335Sgblack@eecs.umich.edu#include "base/trace.hh" 356335Sgblack@eecs.umich.edu#include "cpu/base.hh" 366313Sgblack@eecs.umich.edu#include "cpu/thread_context.hh" 378232Snate@binkert.org#include "debug/MiscRegs.hh" 388232Snate@binkert.org#include "debug/Timer.hh" 396313Sgblack@eecs.umich.edu 406313Sgblack@eecs.umich.edunamespace SparcISA 416313Sgblack@eecs.umich.edu{ 426313Sgblack@eecs.umich.edu 438829Sgblack@eecs.umich.edustatic PSTATE 448829Sgblack@eecs.umich.edubuildPstateMask() 456335Sgblack@eecs.umich.edu{ 468829Sgblack@eecs.umich.edu PSTATE mask = 0; 478829Sgblack@eecs.umich.edu mask.ie = 1; 488829Sgblack@eecs.umich.edu mask.priv = 1; 498829Sgblack@eecs.umich.edu mask.am = 1; 508829Sgblack@eecs.umich.edu mask.pef = 1; 518829Sgblack@eecs.umich.edu mask.mm = 3; 528829Sgblack@eecs.umich.edu mask.tle = 1; 538829Sgblack@eecs.umich.edu mask.cle = 1; 548829Sgblack@eecs.umich.edu mask.pid1 = 1; 558829Sgblack@eecs.umich.edu return mask; 568829Sgblack@eecs.umich.edu} 578829Sgblack@eecs.umich.edu 588829Sgblack@eecs.umich.edustatic const PSTATE PstateMask = buildPstateMask(); 596335Sgblack@eecs.umich.edu 606313Sgblack@eecs.umich.eduvoid 616337Sgblack@eecs.umich.eduISA::reloadRegMap() 626337Sgblack@eecs.umich.edu{ 636337Sgblack@eecs.umich.edu installGlobals(gl, CurrentGlobalsOffset); 646337Sgblack@eecs.umich.edu installWindow(cwp, CurrentWindowOffset); 656337Sgblack@eecs.umich.edu // Microcode registers. 666337Sgblack@eecs.umich.edu for (int i = 0; i < NumMicroIntRegs; i++) 676337Sgblack@eecs.umich.edu intRegMap[MicroIntOffset + i] = i + TotalGlobals + NWindows * 16; 686337Sgblack@eecs.umich.edu installGlobals(gl, NextGlobalsOffset); 696337Sgblack@eecs.umich.edu installWindow(cwp - 1, NextWindowOffset); 706337Sgblack@eecs.umich.edu installGlobals(gl, PreviousGlobalsOffset); 716337Sgblack@eecs.umich.edu installWindow(cwp + 1, PreviousWindowOffset); 726337Sgblack@eecs.umich.edu} 736337Sgblack@eecs.umich.edu 746337Sgblack@eecs.umich.eduvoid 756337Sgblack@eecs.umich.eduISA::installWindow(int cwp, int offset) 766337Sgblack@eecs.umich.edu{ 776337Sgblack@eecs.umich.edu assert(offset >= 0 && offset + NumWindowedRegs <= NumIntRegs); 786337Sgblack@eecs.umich.edu RegIndex *mapChunk = intRegMap + offset; 796337Sgblack@eecs.umich.edu for (int i = 0; i < NumWindowedRegs; i++) 806337Sgblack@eecs.umich.edu mapChunk[i] = TotalGlobals + 816337Sgblack@eecs.umich.edu ((i - cwp * RegsPerWindow + TotalWindowed) % (TotalWindowed)); 826337Sgblack@eecs.umich.edu} 836337Sgblack@eecs.umich.edu 846337Sgblack@eecs.umich.eduvoid 856337Sgblack@eecs.umich.eduISA::installGlobals(int gl, int offset) 866337Sgblack@eecs.umich.edu{ 876337Sgblack@eecs.umich.edu assert(offset >= 0 && offset + NumGlobalRegs <= NumIntRegs); 886337Sgblack@eecs.umich.edu RegIndex *mapChunk = intRegMap + offset; 896337Sgblack@eecs.umich.edu mapChunk[0] = 0; 906337Sgblack@eecs.umich.edu for (int i = 1; i < NumGlobalRegs; i++) 916337Sgblack@eecs.umich.edu mapChunk[i] = i + gl * NumGlobalRegs; 926337Sgblack@eecs.umich.edu} 936337Sgblack@eecs.umich.edu 946337Sgblack@eecs.umich.eduvoid 956313Sgblack@eecs.umich.eduISA::clear() 966313Sgblack@eecs.umich.edu{ 976337Sgblack@eecs.umich.edu cwp = 0; 986337Sgblack@eecs.umich.edu gl = 0; 996337Sgblack@eecs.umich.edu reloadRegMap(); 1006337Sgblack@eecs.umich.edu 1017741Sgblack@eecs.umich.edu // y = 0; 1027741Sgblack@eecs.umich.edu // ccr = 0; 1036335Sgblack@eecs.umich.edu asi = 0; 1046335Sgblack@eecs.umich.edu tick = ULL(1) << 63; 1056335Sgblack@eecs.umich.edu fprs = 0; 1066335Sgblack@eecs.umich.edu gsr = 0; 1076335Sgblack@eecs.umich.edu softint = 0; 1086335Sgblack@eecs.umich.edu tick_cmpr = 0; 1096335Sgblack@eecs.umich.edu stick = 0; 1106335Sgblack@eecs.umich.edu stick_cmpr = 0; 1116335Sgblack@eecs.umich.edu memset(tpc, 0, sizeof(tpc)); 1126335Sgblack@eecs.umich.edu memset(tnpc, 0, sizeof(tnpc)); 1136335Sgblack@eecs.umich.edu memset(tstate, 0, sizeof(tstate)); 1146335Sgblack@eecs.umich.edu memset(tt, 0, sizeof(tt)); 1157703Sgblack@eecs.umich.edu tba = 0; 1166335Sgblack@eecs.umich.edu pstate = 0; 1176335Sgblack@eecs.umich.edu tl = 0; 1186335Sgblack@eecs.umich.edu pil = 0; 1197741Sgblack@eecs.umich.edu // cansave = 0; 1207741Sgblack@eecs.umich.edu // canrestore = 0; 1217741Sgblack@eecs.umich.edu // cleanwin = 0; 1227741Sgblack@eecs.umich.edu // otherwin = 0; 1237741Sgblack@eecs.umich.edu // wstate = 0; 1247741Sgblack@eecs.umich.edu // In a T1, bit 11 is apparently always 1 1258829Sgblack@eecs.umich.edu hpstate = 0; 1268829Sgblack@eecs.umich.edu hpstate.id = 1; 1276335Sgblack@eecs.umich.edu memset(htstate, 0, sizeof(htstate)); 1286335Sgblack@eecs.umich.edu hintp = 0; 1296335Sgblack@eecs.umich.edu htba = 0; 1306335Sgblack@eecs.umich.edu hstick_cmpr = 0; 1317741Sgblack@eecs.umich.edu // This is set this way in Legion for some reason 1326335Sgblack@eecs.umich.edu strandStatusReg = 0x50000; 1336335Sgblack@eecs.umich.edu fsr = 0; 1346335Sgblack@eecs.umich.edu 1356335Sgblack@eecs.umich.edu priContext = 0; 1366335Sgblack@eecs.umich.edu secContext = 0; 1376335Sgblack@eecs.umich.edu partId = 0; 1386335Sgblack@eecs.umich.edu lsuCtrlReg = 0; 1396335Sgblack@eecs.umich.edu 1406335Sgblack@eecs.umich.edu memset(scratchPad, 0, sizeof(scratchPad)); 1417703Sgblack@eecs.umich.edu 1427703Sgblack@eecs.umich.edu cpu_mondo_head = 0; 1437703Sgblack@eecs.umich.edu cpu_mondo_tail = 0; 1447703Sgblack@eecs.umich.edu dev_mondo_head = 0; 1457703Sgblack@eecs.umich.edu dev_mondo_tail = 0; 1467703Sgblack@eecs.umich.edu res_error_head = 0; 1477703Sgblack@eecs.umich.edu res_error_tail = 0; 1487703Sgblack@eecs.umich.edu nres_error_head = 0; 1497703Sgblack@eecs.umich.edu nres_error_tail = 0; 1507703Sgblack@eecs.umich.edu 1517703Sgblack@eecs.umich.edu // If one of these events is active, it's not obvious to me how to get 1527703Sgblack@eecs.umich.edu // rid of it cleanly. For now we'll just assert that they're not. 1537703Sgblack@eecs.umich.edu if (tickCompare != NULL && sTickCompare != NULL && hSTickCompare != NULL) 1547703Sgblack@eecs.umich.edu panic("Tick comparison event active when clearing the ISA object.\n"); 1556313Sgblack@eecs.umich.edu} 1566313Sgblack@eecs.umich.edu 1576313Sgblack@eecs.umich.eduMiscReg 1586313Sgblack@eecs.umich.eduISA::readMiscRegNoEffect(int miscReg) 1596313Sgblack@eecs.umich.edu{ 1606335Sgblack@eecs.umich.edu 1616335Sgblack@eecs.umich.edu // The three miscRegs are moved up from the switch statement 1626335Sgblack@eecs.umich.edu // due to more frequent calls. 1636335Sgblack@eecs.umich.edu 1646335Sgblack@eecs.umich.edu if (miscReg == MISCREG_GL) 1656335Sgblack@eecs.umich.edu return gl; 1666335Sgblack@eecs.umich.edu if (miscReg == MISCREG_CWP) 1676335Sgblack@eecs.umich.edu return cwp; 1686335Sgblack@eecs.umich.edu if (miscReg == MISCREG_TLB_DATA) { 1696335Sgblack@eecs.umich.edu /* Package up all the data for the tlb: 1706335Sgblack@eecs.umich.edu * 6666555555555544444444443333333333222222222211111111110000000000 1716335Sgblack@eecs.umich.edu * 3210987654321098765432109876543210987654321098765432109876543210 1726335Sgblack@eecs.umich.edu * secContext | priContext | |tl|partid| |||||^hpriv 1736335Sgblack@eecs.umich.edu * ||||^red 1746335Sgblack@eecs.umich.edu * |||^priv 1756335Sgblack@eecs.umich.edu * ||^am 1766335Sgblack@eecs.umich.edu * |^lsuim 1776335Sgblack@eecs.umich.edu * ^lsudm 1786335Sgblack@eecs.umich.edu */ 1798829Sgblack@eecs.umich.edu return (uint64_t)hpstate.hpriv | 1808829Sgblack@eecs.umich.edu (uint64_t)hpstate.red << 1 | 1818829Sgblack@eecs.umich.edu (uint64_t)pstate.priv << 2 | 1828829Sgblack@eecs.umich.edu (uint64_t)pstate.am << 3 | 1836335Sgblack@eecs.umich.edu bits((uint64_t)lsuCtrlReg,3,2) << 4 | 1846335Sgblack@eecs.umich.edu bits((uint64_t)partId,7,0) << 8 | 1856335Sgblack@eecs.umich.edu bits((uint64_t)tl,2,0) << 16 | 1866335Sgblack@eecs.umich.edu (uint64_t)priContext << 32 | 1876335Sgblack@eecs.umich.edu (uint64_t)secContext << 48; 1886335Sgblack@eecs.umich.edu } 1896335Sgblack@eecs.umich.edu 1906335Sgblack@eecs.umich.edu switch (miscReg) { 1917741Sgblack@eecs.umich.edu // case MISCREG_TLB_DATA: 1926335Sgblack@eecs.umich.edu // [original contents see above] 1937741Sgblack@eecs.umich.edu // case MISCREG_Y: 1946335Sgblack@eecs.umich.edu // return y; 1957741Sgblack@eecs.umich.edu // case MISCREG_CCR: 1966335Sgblack@eecs.umich.edu // return ccr; 1976335Sgblack@eecs.umich.edu case MISCREG_ASI: 1986335Sgblack@eecs.umich.edu return asi; 1996335Sgblack@eecs.umich.edu case MISCREG_FPRS: 2006335Sgblack@eecs.umich.edu return fprs; 2016335Sgblack@eecs.umich.edu case MISCREG_TICK: 2026335Sgblack@eecs.umich.edu return tick; 2036335Sgblack@eecs.umich.edu case MISCREG_PCR: 2046335Sgblack@eecs.umich.edu panic("PCR not implemented\n"); 2056335Sgblack@eecs.umich.edu case MISCREG_PIC: 2066335Sgblack@eecs.umich.edu panic("PIC not implemented\n"); 2076335Sgblack@eecs.umich.edu case MISCREG_GSR: 2086335Sgblack@eecs.umich.edu return gsr; 2096335Sgblack@eecs.umich.edu case MISCREG_SOFTINT: 2106335Sgblack@eecs.umich.edu return softint; 2116335Sgblack@eecs.umich.edu case MISCREG_TICK_CMPR: 2126335Sgblack@eecs.umich.edu return tick_cmpr; 2136335Sgblack@eecs.umich.edu case MISCREG_STICK: 2146335Sgblack@eecs.umich.edu return stick; 2156335Sgblack@eecs.umich.edu case MISCREG_STICK_CMPR: 2166335Sgblack@eecs.umich.edu return stick_cmpr; 2176335Sgblack@eecs.umich.edu 2186335Sgblack@eecs.umich.edu /** Privilged Registers */ 2196335Sgblack@eecs.umich.edu case MISCREG_TPC: 2206335Sgblack@eecs.umich.edu return tpc[tl-1]; 2216335Sgblack@eecs.umich.edu case MISCREG_TNPC: 2226335Sgblack@eecs.umich.edu return tnpc[tl-1]; 2236335Sgblack@eecs.umich.edu case MISCREG_TSTATE: 2246335Sgblack@eecs.umich.edu return tstate[tl-1]; 2256335Sgblack@eecs.umich.edu case MISCREG_TT: 2266335Sgblack@eecs.umich.edu return tt[tl-1]; 2276335Sgblack@eecs.umich.edu case MISCREG_PRIVTICK: 2286335Sgblack@eecs.umich.edu panic("Priviliged access to tick registers not implemented\n"); 2296335Sgblack@eecs.umich.edu case MISCREG_TBA: 2306335Sgblack@eecs.umich.edu return tba; 2316335Sgblack@eecs.umich.edu case MISCREG_PSTATE: 2328829Sgblack@eecs.umich.edu return (MiscReg)pstate; 2336335Sgblack@eecs.umich.edu case MISCREG_TL: 2346335Sgblack@eecs.umich.edu return tl; 2356335Sgblack@eecs.umich.edu case MISCREG_PIL: 2366335Sgblack@eecs.umich.edu return pil; 2377741Sgblack@eecs.umich.edu // CWP, GL moved 2387741Sgblack@eecs.umich.edu // case MISCREG_CWP: 2397741Sgblack@eecs.umich.edu // return cwp; 2407741Sgblack@eecs.umich.edu // case MISCREG_CANSAVE: 2417741Sgblack@eecs.umich.edu // return cansave; 2427741Sgblack@eecs.umich.edu // case MISCREG_CANRESTORE: 2437741Sgblack@eecs.umich.edu // return canrestore; 2447741Sgblack@eecs.umich.edu // case MISCREG_CLEANWIN: 2457741Sgblack@eecs.umich.edu // return cleanwin; 2467741Sgblack@eecs.umich.edu // case MISCREG_OTHERWIN: 2477741Sgblack@eecs.umich.edu // return otherwin; 2487741Sgblack@eecs.umich.edu // case MISCREG_WSTATE: 2497741Sgblack@eecs.umich.edu // return wstate; 2507741Sgblack@eecs.umich.edu // case MISCREG_GL: 2517741Sgblack@eecs.umich.edu // return gl; 2526335Sgblack@eecs.umich.edu 2536335Sgblack@eecs.umich.edu /** Hyper privileged registers */ 2546335Sgblack@eecs.umich.edu case MISCREG_HPSTATE: 2558829Sgblack@eecs.umich.edu return (MiscReg)hpstate; 2566335Sgblack@eecs.umich.edu case MISCREG_HTSTATE: 2576335Sgblack@eecs.umich.edu return htstate[tl-1]; 2586335Sgblack@eecs.umich.edu case MISCREG_HINTP: 2596335Sgblack@eecs.umich.edu return hintp; 2606335Sgblack@eecs.umich.edu case MISCREG_HTBA: 2616335Sgblack@eecs.umich.edu return htba; 2626335Sgblack@eecs.umich.edu case MISCREG_STRAND_STS_REG: 2636335Sgblack@eecs.umich.edu return strandStatusReg; 2646335Sgblack@eecs.umich.edu case MISCREG_HSTICK_CMPR: 2656335Sgblack@eecs.umich.edu return hstick_cmpr; 2666335Sgblack@eecs.umich.edu 2676335Sgblack@eecs.umich.edu /** Floating Point Status Register */ 2686335Sgblack@eecs.umich.edu case MISCREG_FSR: 2696335Sgblack@eecs.umich.edu DPRINTF(MiscRegs, "FSR read as: %#x\n", fsr); 2706335Sgblack@eecs.umich.edu return fsr; 2716335Sgblack@eecs.umich.edu 2726335Sgblack@eecs.umich.edu case MISCREG_MMU_P_CONTEXT: 2736335Sgblack@eecs.umich.edu return priContext; 2746335Sgblack@eecs.umich.edu case MISCREG_MMU_S_CONTEXT: 2756335Sgblack@eecs.umich.edu return secContext; 2766335Sgblack@eecs.umich.edu case MISCREG_MMU_PART_ID: 2776335Sgblack@eecs.umich.edu return partId; 2786335Sgblack@eecs.umich.edu case MISCREG_MMU_LSU_CTRL: 2796335Sgblack@eecs.umich.edu return lsuCtrlReg; 2806335Sgblack@eecs.umich.edu 2816335Sgblack@eecs.umich.edu case MISCREG_SCRATCHPAD_R0: 2826335Sgblack@eecs.umich.edu return scratchPad[0]; 2836335Sgblack@eecs.umich.edu case MISCREG_SCRATCHPAD_R1: 2846335Sgblack@eecs.umich.edu return scratchPad[1]; 2856335Sgblack@eecs.umich.edu case MISCREG_SCRATCHPAD_R2: 2866335Sgblack@eecs.umich.edu return scratchPad[2]; 2876335Sgblack@eecs.umich.edu case MISCREG_SCRATCHPAD_R3: 2886335Sgblack@eecs.umich.edu return scratchPad[3]; 2896335Sgblack@eecs.umich.edu case MISCREG_SCRATCHPAD_R4: 2906335Sgblack@eecs.umich.edu return scratchPad[4]; 2916335Sgblack@eecs.umich.edu case MISCREG_SCRATCHPAD_R5: 2926335Sgblack@eecs.umich.edu return scratchPad[5]; 2936335Sgblack@eecs.umich.edu case MISCREG_SCRATCHPAD_R6: 2946335Sgblack@eecs.umich.edu return scratchPad[6]; 2956335Sgblack@eecs.umich.edu case MISCREG_SCRATCHPAD_R7: 2966335Sgblack@eecs.umich.edu return scratchPad[7]; 2976335Sgblack@eecs.umich.edu case MISCREG_QUEUE_CPU_MONDO_HEAD: 2986335Sgblack@eecs.umich.edu return cpu_mondo_head; 2996335Sgblack@eecs.umich.edu case MISCREG_QUEUE_CPU_MONDO_TAIL: 3006335Sgblack@eecs.umich.edu return cpu_mondo_tail; 3016335Sgblack@eecs.umich.edu case MISCREG_QUEUE_DEV_MONDO_HEAD: 3026335Sgblack@eecs.umich.edu return dev_mondo_head; 3036335Sgblack@eecs.umich.edu case MISCREG_QUEUE_DEV_MONDO_TAIL: 3046335Sgblack@eecs.umich.edu return dev_mondo_tail; 3056335Sgblack@eecs.umich.edu case MISCREG_QUEUE_RES_ERROR_HEAD: 3066335Sgblack@eecs.umich.edu return res_error_head; 3076335Sgblack@eecs.umich.edu case MISCREG_QUEUE_RES_ERROR_TAIL: 3086335Sgblack@eecs.umich.edu return res_error_tail; 3096335Sgblack@eecs.umich.edu case MISCREG_QUEUE_NRES_ERROR_HEAD: 3106335Sgblack@eecs.umich.edu return nres_error_head; 3116335Sgblack@eecs.umich.edu case MISCREG_QUEUE_NRES_ERROR_TAIL: 3126335Sgblack@eecs.umich.edu return nres_error_tail; 3136335Sgblack@eecs.umich.edu default: 3146335Sgblack@eecs.umich.edu panic("Miscellaneous register %d not implemented\n", miscReg); 3156335Sgblack@eecs.umich.edu } 3166313Sgblack@eecs.umich.edu} 3176313Sgblack@eecs.umich.edu 3186313Sgblack@eecs.umich.eduMiscReg 3196335Sgblack@eecs.umich.eduISA::readMiscReg(int miscReg, ThreadContext * tc) 3206313Sgblack@eecs.umich.edu{ 3216335Sgblack@eecs.umich.edu switch (miscReg) { 3226335Sgblack@eecs.umich.edu // tick and stick are aliased to each other in niagra 3236335Sgblack@eecs.umich.edu // well store the tick data in stick and the interrupt bit in tick 3246335Sgblack@eecs.umich.edu case MISCREG_STICK: 3256335Sgblack@eecs.umich.edu case MISCREG_TICK: 3266335Sgblack@eecs.umich.edu case MISCREG_PRIVTICK: 3276335Sgblack@eecs.umich.edu // I'm not sure why legion ignores the lowest two bits, but we'll go 3286335Sgblack@eecs.umich.edu // with it 3296335Sgblack@eecs.umich.edu // change from curCycle() to instCount() until we're done with legion 3306335Sgblack@eecs.umich.edu DPRINTF(Timer, "Instruction Count when TICK read: %#X stick=%#X\n", 3316335Sgblack@eecs.umich.edu tc->getCpuPtr()->instCount(), stick); 3326335Sgblack@eecs.umich.edu return mbits(tc->getCpuPtr()->instCount() + (int64_t)stick,62,2) | 3336335Sgblack@eecs.umich.edu mbits(tick,63,63); 3346335Sgblack@eecs.umich.edu case MISCREG_FPRS: 3356335Sgblack@eecs.umich.edu // in legion if fp is enabled du and dl are set 3366335Sgblack@eecs.umich.edu return fprs | 0x3; 3376335Sgblack@eecs.umich.edu case MISCREG_PCR: 3386335Sgblack@eecs.umich.edu case MISCREG_PIC: 3396335Sgblack@eecs.umich.edu panic("Performance Instrumentation not impl\n"); 3406335Sgblack@eecs.umich.edu case MISCREG_SOFTINT_CLR: 3416335Sgblack@eecs.umich.edu case MISCREG_SOFTINT_SET: 3426335Sgblack@eecs.umich.edu panic("Can read from softint clr/set\n"); 3436335Sgblack@eecs.umich.edu case MISCREG_SOFTINT: 3446335Sgblack@eecs.umich.edu case MISCREG_TICK_CMPR: 3456335Sgblack@eecs.umich.edu case MISCREG_STICK_CMPR: 3466335Sgblack@eecs.umich.edu case MISCREG_HINTP: 3476335Sgblack@eecs.umich.edu case MISCREG_HTSTATE: 3486335Sgblack@eecs.umich.edu case MISCREG_HTBA: 3496335Sgblack@eecs.umich.edu case MISCREG_HVER: 3506335Sgblack@eecs.umich.edu case MISCREG_STRAND_STS_REG: 3516335Sgblack@eecs.umich.edu case MISCREG_HSTICK_CMPR: 3526335Sgblack@eecs.umich.edu case MISCREG_QUEUE_CPU_MONDO_HEAD: 3536335Sgblack@eecs.umich.edu case MISCREG_QUEUE_CPU_MONDO_TAIL: 3546335Sgblack@eecs.umich.edu case MISCREG_QUEUE_DEV_MONDO_HEAD: 3556335Sgblack@eecs.umich.edu case MISCREG_QUEUE_DEV_MONDO_TAIL: 3566335Sgblack@eecs.umich.edu case MISCREG_QUEUE_RES_ERROR_HEAD: 3576335Sgblack@eecs.umich.edu case MISCREG_QUEUE_RES_ERROR_TAIL: 3586335Sgblack@eecs.umich.edu case MISCREG_QUEUE_NRES_ERROR_HEAD: 3596335Sgblack@eecs.umich.edu case MISCREG_QUEUE_NRES_ERROR_TAIL: 3606335Sgblack@eecs.umich.edu case MISCREG_HPSTATE: 3616335Sgblack@eecs.umich.edu return readFSReg(miscReg, tc); 3626335Sgblack@eecs.umich.edu } 3636335Sgblack@eecs.umich.edu return readMiscRegNoEffect(miscReg); 3646313Sgblack@eecs.umich.edu} 3656313Sgblack@eecs.umich.edu 3666313Sgblack@eecs.umich.eduvoid 3676335Sgblack@eecs.umich.eduISA::setMiscRegNoEffect(int miscReg, MiscReg val) 3686313Sgblack@eecs.umich.edu{ 3696335Sgblack@eecs.umich.edu switch (miscReg) { 3706335Sgblack@eecs.umich.edu// case MISCREG_Y: 3716335Sgblack@eecs.umich.edu// y = val; 3726335Sgblack@eecs.umich.edu// break; 3736335Sgblack@eecs.umich.edu// case MISCREG_CCR: 3746335Sgblack@eecs.umich.edu// ccr = val; 3756335Sgblack@eecs.umich.edu// break; 3766335Sgblack@eecs.umich.edu case MISCREG_ASI: 3776335Sgblack@eecs.umich.edu asi = val; 3786335Sgblack@eecs.umich.edu break; 3796335Sgblack@eecs.umich.edu case MISCREG_FPRS: 3806335Sgblack@eecs.umich.edu fprs = val; 3816335Sgblack@eecs.umich.edu break; 3826335Sgblack@eecs.umich.edu case MISCREG_TICK: 3836335Sgblack@eecs.umich.edu tick = val; 3846335Sgblack@eecs.umich.edu break; 3856335Sgblack@eecs.umich.edu case MISCREG_PCR: 3866335Sgblack@eecs.umich.edu panic("PCR not implemented\n"); 3876335Sgblack@eecs.umich.edu case MISCREG_PIC: 3886335Sgblack@eecs.umich.edu panic("PIC not implemented\n"); 3896335Sgblack@eecs.umich.edu case MISCREG_GSR: 3906335Sgblack@eecs.umich.edu gsr = val; 3916335Sgblack@eecs.umich.edu break; 3926335Sgblack@eecs.umich.edu case MISCREG_SOFTINT: 3936335Sgblack@eecs.umich.edu softint = val; 3946335Sgblack@eecs.umich.edu break; 3956335Sgblack@eecs.umich.edu case MISCREG_TICK_CMPR: 3966335Sgblack@eecs.umich.edu tick_cmpr = val; 3976335Sgblack@eecs.umich.edu break; 3986335Sgblack@eecs.umich.edu case MISCREG_STICK: 3996335Sgblack@eecs.umich.edu stick = val; 4006335Sgblack@eecs.umich.edu break; 4016335Sgblack@eecs.umich.edu case MISCREG_STICK_CMPR: 4026335Sgblack@eecs.umich.edu stick_cmpr = val; 4036335Sgblack@eecs.umich.edu break; 4046335Sgblack@eecs.umich.edu 4056335Sgblack@eecs.umich.edu /** Privilged Registers */ 4066335Sgblack@eecs.umich.edu case MISCREG_TPC: 4076335Sgblack@eecs.umich.edu tpc[tl-1] = val; 4086335Sgblack@eecs.umich.edu break; 4096335Sgblack@eecs.umich.edu case MISCREG_TNPC: 4106335Sgblack@eecs.umich.edu tnpc[tl-1] = val; 4116335Sgblack@eecs.umich.edu break; 4126335Sgblack@eecs.umich.edu case MISCREG_TSTATE: 4136335Sgblack@eecs.umich.edu tstate[tl-1] = val; 4146335Sgblack@eecs.umich.edu break; 4156335Sgblack@eecs.umich.edu case MISCREG_TT: 4166335Sgblack@eecs.umich.edu tt[tl-1] = val; 4176335Sgblack@eecs.umich.edu break; 4186335Sgblack@eecs.umich.edu case MISCREG_PRIVTICK: 4196335Sgblack@eecs.umich.edu panic("Priviliged access to tick regesiters not implemented\n"); 4206335Sgblack@eecs.umich.edu case MISCREG_TBA: 4216335Sgblack@eecs.umich.edu // clear lower 7 bits on writes. 4226335Sgblack@eecs.umich.edu tba = val & ULL(~0x7FFF); 4236335Sgblack@eecs.umich.edu break; 4246335Sgblack@eecs.umich.edu case MISCREG_PSTATE: 4258829Sgblack@eecs.umich.edu pstate = (val & PstateMask); 4266335Sgblack@eecs.umich.edu break; 4276335Sgblack@eecs.umich.edu case MISCREG_TL: 4286335Sgblack@eecs.umich.edu tl = val; 4296335Sgblack@eecs.umich.edu break; 4306335Sgblack@eecs.umich.edu case MISCREG_PIL: 4316335Sgblack@eecs.umich.edu pil = val; 4326335Sgblack@eecs.umich.edu break; 4336335Sgblack@eecs.umich.edu case MISCREG_CWP: 4346335Sgblack@eecs.umich.edu cwp = val; 4356335Sgblack@eecs.umich.edu break; 4366335Sgblack@eecs.umich.edu// case MISCREG_CANSAVE: 4376335Sgblack@eecs.umich.edu// cansave = val; 4386335Sgblack@eecs.umich.edu// break; 4396335Sgblack@eecs.umich.edu// case MISCREG_CANRESTORE: 4406335Sgblack@eecs.umich.edu// canrestore = val; 4416335Sgblack@eecs.umich.edu// break; 4426335Sgblack@eecs.umich.edu// case MISCREG_CLEANWIN: 4436335Sgblack@eecs.umich.edu// cleanwin = val; 4446335Sgblack@eecs.umich.edu// break; 4456335Sgblack@eecs.umich.edu// case MISCREG_OTHERWIN: 4466335Sgblack@eecs.umich.edu// otherwin = val; 4476335Sgblack@eecs.umich.edu// break; 4486335Sgblack@eecs.umich.edu// case MISCREG_WSTATE: 4496335Sgblack@eecs.umich.edu// wstate = val; 4506335Sgblack@eecs.umich.edu// break; 4516335Sgblack@eecs.umich.edu case MISCREG_GL: 4526335Sgblack@eecs.umich.edu gl = val; 4536335Sgblack@eecs.umich.edu break; 4546335Sgblack@eecs.umich.edu 4556335Sgblack@eecs.umich.edu /** Hyper privileged registers */ 4566335Sgblack@eecs.umich.edu case MISCREG_HPSTATE: 4576335Sgblack@eecs.umich.edu hpstate = val; 4586335Sgblack@eecs.umich.edu break; 4596335Sgblack@eecs.umich.edu case MISCREG_HTSTATE: 4606335Sgblack@eecs.umich.edu htstate[tl-1] = val; 4616335Sgblack@eecs.umich.edu break; 4626335Sgblack@eecs.umich.edu case MISCREG_HINTP: 4636335Sgblack@eecs.umich.edu hintp = val; 4646335Sgblack@eecs.umich.edu case MISCREG_HTBA: 4656335Sgblack@eecs.umich.edu htba = val; 4666335Sgblack@eecs.umich.edu break; 4676335Sgblack@eecs.umich.edu case MISCREG_STRAND_STS_REG: 4686335Sgblack@eecs.umich.edu strandStatusReg = val; 4696335Sgblack@eecs.umich.edu break; 4706335Sgblack@eecs.umich.edu case MISCREG_HSTICK_CMPR: 4716335Sgblack@eecs.umich.edu hstick_cmpr = val; 4726335Sgblack@eecs.umich.edu break; 4736335Sgblack@eecs.umich.edu 4746335Sgblack@eecs.umich.edu /** Floating Point Status Register */ 4756335Sgblack@eecs.umich.edu case MISCREG_FSR: 4766335Sgblack@eecs.umich.edu fsr = val; 4776335Sgblack@eecs.umich.edu DPRINTF(MiscRegs, "FSR written with: %#x\n", fsr); 4786335Sgblack@eecs.umich.edu break; 4796335Sgblack@eecs.umich.edu 4806335Sgblack@eecs.umich.edu case MISCREG_MMU_P_CONTEXT: 4816335Sgblack@eecs.umich.edu priContext = val; 4826335Sgblack@eecs.umich.edu break; 4836335Sgblack@eecs.umich.edu case MISCREG_MMU_S_CONTEXT: 4846335Sgblack@eecs.umich.edu secContext = val; 4856335Sgblack@eecs.umich.edu break; 4866335Sgblack@eecs.umich.edu case MISCREG_MMU_PART_ID: 4876335Sgblack@eecs.umich.edu partId = val; 4886335Sgblack@eecs.umich.edu break; 4896335Sgblack@eecs.umich.edu case MISCREG_MMU_LSU_CTRL: 4906335Sgblack@eecs.umich.edu lsuCtrlReg = val; 4916335Sgblack@eecs.umich.edu break; 4926335Sgblack@eecs.umich.edu 4936335Sgblack@eecs.umich.edu case MISCREG_SCRATCHPAD_R0: 4946335Sgblack@eecs.umich.edu scratchPad[0] = val; 4956335Sgblack@eecs.umich.edu break; 4966335Sgblack@eecs.umich.edu case MISCREG_SCRATCHPAD_R1: 4976335Sgblack@eecs.umich.edu scratchPad[1] = val; 4986335Sgblack@eecs.umich.edu break; 4996335Sgblack@eecs.umich.edu case MISCREG_SCRATCHPAD_R2: 5006335Sgblack@eecs.umich.edu scratchPad[2] = val; 5016335Sgblack@eecs.umich.edu break; 5026335Sgblack@eecs.umich.edu case MISCREG_SCRATCHPAD_R3: 5036335Sgblack@eecs.umich.edu scratchPad[3] = val; 5046335Sgblack@eecs.umich.edu break; 5056335Sgblack@eecs.umich.edu case MISCREG_SCRATCHPAD_R4: 5066335Sgblack@eecs.umich.edu scratchPad[4] = val; 5076335Sgblack@eecs.umich.edu break; 5086335Sgblack@eecs.umich.edu case MISCREG_SCRATCHPAD_R5: 5096335Sgblack@eecs.umich.edu scratchPad[5] = val; 5106335Sgblack@eecs.umich.edu break; 5116335Sgblack@eecs.umich.edu case MISCREG_SCRATCHPAD_R6: 5126335Sgblack@eecs.umich.edu scratchPad[6] = val; 5136335Sgblack@eecs.umich.edu break; 5146335Sgblack@eecs.umich.edu case MISCREG_SCRATCHPAD_R7: 5156335Sgblack@eecs.umich.edu scratchPad[7] = val; 5166335Sgblack@eecs.umich.edu break; 5176335Sgblack@eecs.umich.edu case MISCREG_QUEUE_CPU_MONDO_HEAD: 5186335Sgblack@eecs.umich.edu cpu_mondo_head = val; 5196335Sgblack@eecs.umich.edu break; 5206335Sgblack@eecs.umich.edu case MISCREG_QUEUE_CPU_MONDO_TAIL: 5216335Sgblack@eecs.umich.edu cpu_mondo_tail = val; 5226335Sgblack@eecs.umich.edu break; 5236335Sgblack@eecs.umich.edu case MISCREG_QUEUE_DEV_MONDO_HEAD: 5246335Sgblack@eecs.umich.edu dev_mondo_head = val; 5256335Sgblack@eecs.umich.edu break; 5266335Sgblack@eecs.umich.edu case MISCREG_QUEUE_DEV_MONDO_TAIL: 5276335Sgblack@eecs.umich.edu dev_mondo_tail = val; 5286335Sgblack@eecs.umich.edu break; 5296335Sgblack@eecs.umich.edu case MISCREG_QUEUE_RES_ERROR_HEAD: 5306335Sgblack@eecs.umich.edu res_error_head = val; 5316335Sgblack@eecs.umich.edu break; 5326335Sgblack@eecs.umich.edu case MISCREG_QUEUE_RES_ERROR_TAIL: 5336335Sgblack@eecs.umich.edu res_error_tail = val; 5346335Sgblack@eecs.umich.edu break; 5356335Sgblack@eecs.umich.edu case MISCREG_QUEUE_NRES_ERROR_HEAD: 5366335Sgblack@eecs.umich.edu nres_error_head = val; 5376335Sgblack@eecs.umich.edu break; 5386335Sgblack@eecs.umich.edu case MISCREG_QUEUE_NRES_ERROR_TAIL: 5396335Sgblack@eecs.umich.edu nres_error_tail = val; 5406335Sgblack@eecs.umich.edu break; 5416335Sgblack@eecs.umich.edu default: 5426335Sgblack@eecs.umich.edu panic("Miscellaneous register %d not implemented\n", miscReg); 5436335Sgblack@eecs.umich.edu } 5446313Sgblack@eecs.umich.edu} 5456313Sgblack@eecs.umich.edu 5466313Sgblack@eecs.umich.eduvoid 5476335Sgblack@eecs.umich.eduISA::setMiscReg(int miscReg, MiscReg val, ThreadContext * tc) 5486313Sgblack@eecs.umich.edu{ 5496335Sgblack@eecs.umich.edu MiscReg new_val = val; 5506335Sgblack@eecs.umich.edu 5516335Sgblack@eecs.umich.edu switch (miscReg) { 5526335Sgblack@eecs.umich.edu case MISCREG_STICK: 5536335Sgblack@eecs.umich.edu case MISCREG_TICK: 5546335Sgblack@eecs.umich.edu // stick and tick are same thing on niagra 5556335Sgblack@eecs.umich.edu // use stick for offset and tick for holding intrrupt bit 5566335Sgblack@eecs.umich.edu stick = mbits(val,62,0) - tc->getCpuPtr()->instCount(); 5576335Sgblack@eecs.umich.edu tick = mbits(val,63,63); 5586335Sgblack@eecs.umich.edu DPRINTF(Timer, "Writing TICK=%#X\n", val); 5596335Sgblack@eecs.umich.edu break; 5606335Sgblack@eecs.umich.edu case MISCREG_FPRS: 5617741Sgblack@eecs.umich.edu // Configure the fpu based on the fprs 5626335Sgblack@eecs.umich.edu break; 5636335Sgblack@eecs.umich.edu case MISCREG_PCR: 5647741Sgblack@eecs.umich.edu // Set up performance counting based on pcr value 5656335Sgblack@eecs.umich.edu break; 5666335Sgblack@eecs.umich.edu case MISCREG_PSTATE: 5678829Sgblack@eecs.umich.edu pstate = val & PstateMask; 5686335Sgblack@eecs.umich.edu return; 5696335Sgblack@eecs.umich.edu case MISCREG_TL: 5708829Sgblack@eecs.umich.edu { 5718829Sgblack@eecs.umich.edu tl = val; 5728829Sgblack@eecs.umich.edu if (hpstate.tlz && tl == 0 && !hpstate.hpriv) 5738829Sgblack@eecs.umich.edu tc->getCpuPtr()->postInterrupt(IT_TRAP_LEVEL_ZERO, 0); 5748829Sgblack@eecs.umich.edu else 5758829Sgblack@eecs.umich.edu tc->getCpuPtr()->clearInterrupt(IT_TRAP_LEVEL_ZERO, 0); 5768829Sgblack@eecs.umich.edu return; 5778829Sgblack@eecs.umich.edu } 5786335Sgblack@eecs.umich.edu case MISCREG_CWP: 5796335Sgblack@eecs.umich.edu new_val = val >= NWindows ? NWindows - 1 : val; 5806335Sgblack@eecs.umich.edu if (val >= NWindows) 5816335Sgblack@eecs.umich.edu new_val = NWindows - 1; 5826337Sgblack@eecs.umich.edu 5836337Sgblack@eecs.umich.edu installWindow(new_val, CurrentWindowOffset); 5846337Sgblack@eecs.umich.edu installWindow(new_val - 1, NextWindowOffset); 5856337Sgblack@eecs.umich.edu installWindow(new_val + 1, PreviousWindowOffset); 5866335Sgblack@eecs.umich.edu break; 5876335Sgblack@eecs.umich.edu case MISCREG_GL: 5886337Sgblack@eecs.umich.edu installGlobals(val, CurrentGlobalsOffset); 5896337Sgblack@eecs.umich.edu installGlobals(val, NextGlobalsOffset); 5906337Sgblack@eecs.umich.edu installGlobals(val, PreviousGlobalsOffset); 5916335Sgblack@eecs.umich.edu break; 5926335Sgblack@eecs.umich.edu case MISCREG_PIL: 5936335Sgblack@eecs.umich.edu case MISCREG_SOFTINT: 5946335Sgblack@eecs.umich.edu case MISCREG_SOFTINT_SET: 5956335Sgblack@eecs.umich.edu case MISCREG_SOFTINT_CLR: 5966335Sgblack@eecs.umich.edu case MISCREG_TICK_CMPR: 5976335Sgblack@eecs.umich.edu case MISCREG_STICK_CMPR: 5986335Sgblack@eecs.umich.edu case MISCREG_HINTP: 5996335Sgblack@eecs.umich.edu case MISCREG_HTSTATE: 6006335Sgblack@eecs.umich.edu case MISCREG_HTBA: 6016335Sgblack@eecs.umich.edu case MISCREG_HVER: 6026335Sgblack@eecs.umich.edu case MISCREG_STRAND_STS_REG: 6036335Sgblack@eecs.umich.edu case MISCREG_HSTICK_CMPR: 6046335Sgblack@eecs.umich.edu case MISCREG_QUEUE_CPU_MONDO_HEAD: 6056335Sgblack@eecs.umich.edu case MISCREG_QUEUE_CPU_MONDO_TAIL: 6066335Sgblack@eecs.umich.edu case MISCREG_QUEUE_DEV_MONDO_HEAD: 6076335Sgblack@eecs.umich.edu case MISCREG_QUEUE_DEV_MONDO_TAIL: 6086335Sgblack@eecs.umich.edu case MISCREG_QUEUE_RES_ERROR_HEAD: 6096335Sgblack@eecs.umich.edu case MISCREG_QUEUE_RES_ERROR_TAIL: 6106335Sgblack@eecs.umich.edu case MISCREG_QUEUE_NRES_ERROR_HEAD: 6116335Sgblack@eecs.umich.edu case MISCREG_QUEUE_NRES_ERROR_TAIL: 6126335Sgblack@eecs.umich.edu case MISCREG_HPSTATE: 6136335Sgblack@eecs.umich.edu setFSReg(miscReg, val, tc); 6146335Sgblack@eecs.umich.edu return; 6156335Sgblack@eecs.umich.edu } 6166335Sgblack@eecs.umich.edu setMiscRegNoEffect(miscReg, new_val); 6176335Sgblack@eecs.umich.edu} 6186335Sgblack@eecs.umich.edu 6196335Sgblack@eecs.umich.eduvoid 6206335Sgblack@eecs.umich.eduISA::serialize(EventManager *em, std::ostream &os) 6216335Sgblack@eecs.umich.edu{ 6226335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(asi); 6236335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(tick); 6246335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(fprs); 6256335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(gsr); 6266335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(softint); 6276335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(tick_cmpr); 6286335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(stick); 6296335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(stick_cmpr); 6306335Sgblack@eecs.umich.edu SERIALIZE_ARRAY(tpc,MaxTL); 6316335Sgblack@eecs.umich.edu SERIALIZE_ARRAY(tnpc,MaxTL); 6326335Sgblack@eecs.umich.edu SERIALIZE_ARRAY(tstate,MaxTL); 6336335Sgblack@eecs.umich.edu SERIALIZE_ARRAY(tt,MaxTL); 6346335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(tba); 6358829Sgblack@eecs.umich.edu SERIALIZE_SCALAR((uint16_t)pstate); 6366335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(tl); 6376335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(pil); 6386335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(cwp); 6396335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(gl); 6408829Sgblack@eecs.umich.edu SERIALIZE_SCALAR((uint64_t)hpstate); 6416335Sgblack@eecs.umich.edu SERIALIZE_ARRAY(htstate,MaxTL); 6426335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(hintp); 6436335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(htba); 6446335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(hstick_cmpr); 6456335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(strandStatusReg); 6466335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(fsr); 6476335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(priContext); 6486335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(secContext); 6496335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(partId); 6506335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(lsuCtrlReg); 6516335Sgblack@eecs.umich.edu SERIALIZE_ARRAY(scratchPad,8); 6526335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(cpu_mondo_head); 6536335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(cpu_mondo_tail); 6546335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(dev_mondo_head); 6556335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(dev_mondo_tail); 6566335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(res_error_head); 6576335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(res_error_tail); 6586335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(nres_error_head); 6596335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(nres_error_tail); 6606335Sgblack@eecs.umich.edu Tick tick_cmp = 0, stick_cmp = 0, hstick_cmp = 0; 6616335Sgblack@eecs.umich.edu ThreadContext *tc = NULL; 6626335Sgblack@eecs.umich.edu BaseCPU *cpu = NULL; 6636335Sgblack@eecs.umich.edu int tc_num = 0; 6646335Sgblack@eecs.umich.edu bool tick_intr_sched = true; 6656335Sgblack@eecs.umich.edu 6666335Sgblack@eecs.umich.edu if (tickCompare) 6676335Sgblack@eecs.umich.edu tc = tickCompare->getTC(); 6686335Sgblack@eecs.umich.edu else if (sTickCompare) 6696335Sgblack@eecs.umich.edu tc = sTickCompare->getTC(); 6706335Sgblack@eecs.umich.edu else if (hSTickCompare) 6716335Sgblack@eecs.umich.edu tc = hSTickCompare->getTC(); 6726335Sgblack@eecs.umich.edu else 6736335Sgblack@eecs.umich.edu tick_intr_sched = false; 6746335Sgblack@eecs.umich.edu 6756335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(tick_intr_sched); 6766335Sgblack@eecs.umich.edu 6776335Sgblack@eecs.umich.edu if (tc) { 6786335Sgblack@eecs.umich.edu cpu = tc->getCpuPtr(); 6796335Sgblack@eecs.umich.edu tc_num = cpu->findContext(tc); 6806335Sgblack@eecs.umich.edu if (tickCompare && tickCompare->scheduled()) 6816335Sgblack@eecs.umich.edu tick_cmp = tickCompare->when(); 6826335Sgblack@eecs.umich.edu if (sTickCompare && sTickCompare->scheduled()) 6836335Sgblack@eecs.umich.edu stick_cmp = sTickCompare->when(); 6846335Sgblack@eecs.umich.edu if (hSTickCompare && hSTickCompare->scheduled()) 6856335Sgblack@eecs.umich.edu hstick_cmp = hSTickCompare->when(); 6866335Sgblack@eecs.umich.edu 6876335Sgblack@eecs.umich.edu SERIALIZE_OBJPTR(cpu); 6886335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(tc_num); 6896335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(tick_cmp); 6906335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(stick_cmp); 6916335Sgblack@eecs.umich.edu SERIALIZE_SCALAR(hstick_cmp); 6926335Sgblack@eecs.umich.edu } 6936335Sgblack@eecs.umich.edu} 6946335Sgblack@eecs.umich.edu 6956335Sgblack@eecs.umich.eduvoid 6966335Sgblack@eecs.umich.eduISA::unserialize(EventManager *em, Checkpoint *cp, const std::string §ion) 6976335Sgblack@eecs.umich.edu{ 6986335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(asi); 6996335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(tick); 7006335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(fprs); 7016335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(gsr); 7026335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(softint); 7036335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(tick_cmpr); 7046335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(stick); 7056335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(stick_cmpr); 7066335Sgblack@eecs.umich.edu UNSERIALIZE_ARRAY(tpc,MaxTL); 7076335Sgblack@eecs.umich.edu UNSERIALIZE_ARRAY(tnpc,MaxTL); 7086335Sgblack@eecs.umich.edu UNSERIALIZE_ARRAY(tstate,MaxTL); 7096335Sgblack@eecs.umich.edu UNSERIALIZE_ARRAY(tt,MaxTL); 7106335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(tba); 7118829Sgblack@eecs.umich.edu { 7128829Sgblack@eecs.umich.edu uint16_t pstate; 7138829Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(pstate); 7148829Sgblack@eecs.umich.edu this->pstate = pstate; 7158829Sgblack@eecs.umich.edu } 7166335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(tl); 7176335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(pil); 7186335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(cwp); 7196335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(gl); 7206337Sgblack@eecs.umich.edu reloadRegMap(); 7218829Sgblack@eecs.umich.edu { 7228829Sgblack@eecs.umich.edu uint64_t hpstate; 7238829Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(hpstate); 7248829Sgblack@eecs.umich.edu this->hpstate = hpstate; 7258829Sgblack@eecs.umich.edu } 7266335Sgblack@eecs.umich.edu UNSERIALIZE_ARRAY(htstate,MaxTL); 7276335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(hintp); 7286335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(htba); 7296335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(hstick_cmpr); 7306335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(strandStatusReg); 7316335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(fsr); 7326335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(priContext); 7336335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(secContext); 7346335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(partId); 7356335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(lsuCtrlReg); 7366335Sgblack@eecs.umich.edu UNSERIALIZE_ARRAY(scratchPad,8); 7376335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(cpu_mondo_head); 7386335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(cpu_mondo_tail); 7396335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(dev_mondo_head); 7406335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(dev_mondo_tail); 7416335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(res_error_head); 7426335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(res_error_tail); 7436335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(nres_error_head); 7446335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(nres_error_tail); 7456335Sgblack@eecs.umich.edu 7466335Sgblack@eecs.umich.edu Tick tick_cmp = 0, stick_cmp = 0, hstick_cmp = 0; 7476335Sgblack@eecs.umich.edu ThreadContext *tc = NULL; 7486335Sgblack@eecs.umich.edu BaseCPU *cpu = NULL; 7496335Sgblack@eecs.umich.edu int tc_num; 7506335Sgblack@eecs.umich.edu bool tick_intr_sched; 7516335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(tick_intr_sched); 7526335Sgblack@eecs.umich.edu if (tick_intr_sched) { 7536335Sgblack@eecs.umich.edu UNSERIALIZE_OBJPTR(cpu); 7546335Sgblack@eecs.umich.edu if (cpu) { 7556335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(tc_num); 7566335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(tick_cmp); 7576335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(stick_cmp); 7586335Sgblack@eecs.umich.edu UNSERIALIZE_SCALAR(hstick_cmp); 7596335Sgblack@eecs.umich.edu tc = cpu->getContext(tc_num); 7606335Sgblack@eecs.umich.edu 7616335Sgblack@eecs.umich.edu if (tick_cmp) { 7626335Sgblack@eecs.umich.edu tickCompare = new TickCompareEvent(this, tc); 7636335Sgblack@eecs.umich.edu em->schedule(tickCompare, tick_cmp); 7646335Sgblack@eecs.umich.edu } 7656335Sgblack@eecs.umich.edu if (stick_cmp) { 7666335Sgblack@eecs.umich.edu sTickCompare = new STickCompareEvent(this, tc); 7676335Sgblack@eecs.umich.edu em->schedule(sTickCompare, stick_cmp); 7686335Sgblack@eecs.umich.edu } 7696335Sgblack@eecs.umich.edu if (hstick_cmp) { 7706335Sgblack@eecs.umich.edu hSTickCompare = new HSTickCompareEvent(this, tc); 7716335Sgblack@eecs.umich.edu em->schedule(hSTickCompare, hstick_cmp); 7726335Sgblack@eecs.umich.edu } 7736335Sgblack@eecs.umich.edu } 7746335Sgblack@eecs.umich.edu } 7756335Sgblack@eecs.umich.edu 7766313Sgblack@eecs.umich.edu} 7776313Sgblack@eecs.umich.edu 7786313Sgblack@eecs.umich.edu} 779