summaryrefslogtreecommitdiff
path: root/src/arch/sparc/miscregfile.cc
blob: 93737ad013b066308868903470039c53640b7d08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
/*
 * Copyright (c) 2003-2005 The Regents of The University of Michigan
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met: redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer;
 * redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution;
 * neither the name of the copyright holders nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Authors: Gabe Black
 *          Ali Saidi
 */

#include "arch/sparc/asi.hh"
#include "arch/sparc/miscregfile.hh"
#include "base/bitfield.hh"
#include "base/trace.hh"
#include "config/full_system.hh"
#include "cpu/base.hh"
#include "cpu/thread_context.hh"

#if FULL_SYSTEM
#include "arch/sparc/system.hh"
#endif

using namespace SparcISA;
using namespace std;

class Checkpoint;

//These functions map register indices to names
string SparcISA::getMiscRegName(RegIndex index)
{
    static::string miscRegName[NumMiscRegs] =
        {"y", "ccr", "asi", "tick", "pc", "fprs", "pcr", "pic",
         "gsr", "softint_set", "softint_clr", "softint", "tick_cmpr",
         "stick", "stick_cmpr",
         "tpc", "tnpc", "tstate", "tt", "privtick", "tba", "pstate", "tl",
         "pil", "cwp", "cansave", "canrestore", "cleanwin", "otherwin",
         "wstate", "gl",
         "hpstate", "htstate", "hintp", "htba", "hver", "strand_sts_reg",
         "hstick_cmpr",
         "fsr"};
    return miscRegName[index];
}

void MiscRegFile::reset()
{
    y = 0;
    ccr = 0;
    asi = 0;
    tick = 0;
    fprs = 0;
    gsr = 0;
    softint = 0;
    tick_cmpr = 0;
    stick = 0;
    stick_cmpr = 0;
    memset(tpc, 0, sizeof(tpc));
    memset(tnpc, 0, sizeof(tnpc));
    memset(tstate, 0, sizeof(tstate));
    memset(tt, 0, sizeof(tt));
    pstate = 0;
    tl = 0;
    pil = 0;
    cwp = 0;
    cansave = 0;
    canrestore = 0;
    cleanwin = 0;
    otherwin = 0;
    wstate = 0;
    gl = 0;
    hpstate = 0;
    memset(htstate, 0, sizeof(htstate));
    hintp = 0;
    htba = 0;
    hstick_cmpr = 0;
    strandStatusReg = 0;
    fsr = 0;

    priContext = 0;
    secContext = 0;
    partId = 0;
    lsuCtrlReg = 0;

    iTlbC0TsbPs0 = 0;
    iTlbC0TsbPs1 = 0;
    iTlbC0Config = 0;
    iTlbCXTsbPs0 = 0;
    iTlbCXTsbPs1 = 0;
    iTlbCXConfig = 0;
    iTlbSfsr = 0;
    iTlbTagAccess = 0;

    dTlbC0TsbPs0 = 0;
    dTlbC0TsbPs1 = 0;
    dTlbC0Config = 0;
    dTlbCXTsbPs0 = 0;
    dTlbCXTsbPs1 = 0;
    dTlbCXConfig = 0;
    dTlbSfsr = 0;
    dTlbSfar = 0;
    dTlbTagAccess = 0;

    memset(scratchPad, 0, sizeof(scratchPad));
}

MiscReg MiscRegFile::readReg(int miscReg)
{
    switch (miscReg) {
        case MISCREG_Y:
          return y;
        case MISCREG_CCR:
          return ccr;
        case MISCREG_ASI:
          return asi;
        case MISCREG_FPRS:
          return fprs;
        case MISCREG_TICK:
           return tick;
        case MISCREG_PCR:
          panic("PCR not implemented\n");
        case MISCREG_PIC:
          panic("PIC not implemented\n");
        case MISCREG_GSR:
          return gsr;
        case MISCREG_SOFTINT:
           return softint;
        case MISCREG_TICK_CMPR:
           return tick_cmpr;
        case MISCREG_STICK:
           return stick;
        case MISCREG_STICK_CMPR:
           return stick_cmpr;

        /** Privilged Registers */
        case MISCREG_TPC:
          return tpc[tl-1];
        case MISCREG_TNPC:
          return tnpc[tl-1];
        case MISCREG_TSTATE:
          return tstate[tl-1];
        case MISCREG_TT:
          return tt[tl-1];
        case MISCREG_PRIVTICK:
          panic("Priviliged access to tick registers not implemented\n");
        case MISCREG_TBA:
          return tba;
        case MISCREG_PSTATE:
          return pstate;
        case MISCREG_TL:
          return tl;
        case MISCREG_PIL:
          return pil;
        case MISCREG_CWP:
          return cwp;
        case MISCREG_CANSAVE:
          return cansave;
        case MISCREG_CANRESTORE:
          return canrestore;
        case MISCREG_CLEANWIN:
          return cleanwin;
        case MISCREG_OTHERWIN:
          return otherwin;
        case MISCREG_WSTATE:
          return wstate;
        case MISCREG_GL:
          return gl;

        /** Hyper privileged registers */
        case MISCREG_HPSTATE:
          return hpstate;
        case MISCREG_HTSTATE:
          return htstate[tl-1];
        case MISCREG_HINTP:
          panic("HINTP not implemented\n");
        case MISCREG_HTBA:
          return htba;
        case MISCREG_HVER:
          return NWindows | MaxTL << 8 | MaxGL << 16;
        case MISCREG_STRAND_STS_REG:
          return strandStatusReg;
        case MISCREG_HSTICK_CMPR:
          return hstick_cmpr;

        /** Floating Point Status Register */
        case MISCREG_FSR:
          return fsr;

        case MISCREG_MMU_P_CONTEXT:
          return priContext;
        case MISCREG_MMU_S_CONTEXT:
          return secContext;
        case MISCREG_MMU_PART_ID:
          return partId;
        case MISCREG_MMU_LSU_CTRL:
          return lsuCtrlReg;

        case MISCREG_MMU_ITLB_C0_TSB_PS0:
          return iTlbC0TsbPs0;
        case MISCREG_MMU_ITLB_C0_TSB_PS1:
          return iTlbC0TsbPs1;
        case MISCREG_MMU_ITLB_C0_CONFIG:
          return iTlbC0Config;
        case MISCREG_MMU_ITLB_CX_TSB_PS0:
          return iTlbCXTsbPs0;
        case MISCREG_MMU_ITLB_CX_TSB_PS1:
          return iTlbCXTsbPs1;
        case MISCREG_MMU_ITLB_CX_CONFIG:
          return iTlbCXConfig;
        case MISCREG_MMU_ITLB_SFSR:
          return iTlbSfsr;
        case MISCREG_MMU_ITLB_TAG_ACCESS:
          return iTlbTagAccess;

        case MISCREG_MMU_DTLB_C0_TSB_PS0:
          return dTlbC0TsbPs0;
        case MISCREG_MMU_DTLB_C0_TSB_PS1:
          return dTlbC0TsbPs1;
        case MISCREG_MMU_DTLB_C0_CONFIG:
          return dTlbC0Config;
        case MISCREG_MMU_DTLB_CX_TSB_PS0:
          return dTlbCXTsbPs0;
        case MISCREG_MMU_DTLB_CX_TSB_PS1:
          return dTlbCXTsbPs1;
        case MISCREG_MMU_DTLB_CX_CONFIG:
          return dTlbCXConfig;
        case MISCREG_MMU_DTLB_SFSR:
          return dTlbSfsr;
        case MISCREG_MMU_DTLB_SFAR:
          return dTlbSfar;
        case MISCREG_MMU_DTLB_TAG_ACCESS:
          return dTlbTagAccess;

        case MISCREG_SCRATCHPAD_R0:
          return scratchPad[0];
        case MISCREG_SCRATCHPAD_R1:
          return scratchPad[1];
        case MISCREG_SCRATCHPAD_R2:
          return scratchPad[2];
        case MISCREG_SCRATCHPAD_R3:
          return scratchPad[3];
        case MISCREG_SCRATCHPAD_R4:
          return scratchPad[4];
        case MISCREG_SCRATCHPAD_R5:
          return scratchPad[5];
        case MISCREG_SCRATCHPAD_R6:
          return scratchPad[6];
        case MISCREG_SCRATCHPAD_R7:
          return scratchPad[7];

        default:
          panic("Miscellaneous register %d not implemented\n", miscReg);
    }
}

MiscReg MiscRegFile::readRegWithEffect(int miscReg, ThreadContext * tc)
{
    switch (miscReg) {
        case MISCREG_TICK:
        case MISCREG_PRIVTICK:
          return tc->getCpuPtr()->curCycle() - (tick & mask(63)) |
              (tick & ~(mask(63))) << 63;
        case MISCREG_FPRS:
          panic("FPU not implemented\n");
        case MISCREG_PCR:
        case MISCREG_PIC:
          panic("Performance Instrumentation not impl\n");
        /** Floating Point Status Register */
        case MISCREG_FSR:
          panic("Floating Point not implemented\n");
//We'll include this only in FS so we don't need the SparcSystem type around
//in SE.
#if FULL_SYSTEM
        case MISCREG_STICK:
          SparcSystem *sys;
          sys = dynamic_cast<SparcSystem*>(tc->getSystemPtr());
          assert(sys != NULL);
          return curTick/Clock::Int::ns - sys->sysTick | (stick & ~(mask(63)));
#endif
        case MISCREG_HVER:
          return NWindows | MaxTL << 8 | MaxGL << 16;
    }
    return readReg(miscReg);
}

void MiscRegFile::setReg(int miscReg, const MiscReg &val)
{
    switch (miscReg) {
        case MISCREG_Y:
          y = val;
          break;
        case MISCREG_CCR:
          ccr = val;
          break;
        case MISCREG_ASI:
          asi = val;
          break;
        case MISCREG_FPRS:
          fprs = val;
          break;
        case MISCREG_TICK:
          tick = val;
          break;
        case MISCREG_PCR:
          panic("PCR not implemented\n");
        case MISCREG_PIC:
          panic("PIC not implemented\n");
        case MISCREG_GSR:
          gsr = val;
          break;
        case MISCREG_SOFTINT:
          softint = val;
          break;
        case MISCREG_TICK_CMPR:
          tick_cmpr = val;
          break;
        case MISCREG_STICK:
          stick = val;
          break;
        case MISCREG_STICK_CMPR:
          stick_cmpr = val;
          break;

        /** Privilged Registers */
        case MISCREG_TPC:
          tpc[tl-1] = val;
          break;
        case MISCREG_TNPC:
          tnpc[tl-1] = val;
          break;
        case MISCREG_TSTATE:
          tstate[tl-1] = val;
          break;
        case MISCREG_TT:
          tt[tl-1] = val;
          break;
        case MISCREG_PRIVTICK:
          panic("Priviliged access to tick regesiters not implemented\n");
        case MISCREG_TBA:
          // clear lower 7 bits on writes.
          tba = val & ULL(~0x7FFF);
          break;
        case MISCREG_PSTATE:
          pstate = val;
          break;
        case MISCREG_TL:
          tl = val;
          break;
        case MISCREG_PIL:
          pil = val;
          break;
        case MISCREG_CWP:
          cwp = val;
          break;
        case MISCREG_CANSAVE:
          cansave = val;
          break;
        case MISCREG_CANRESTORE:
          canrestore = val;
          break;
        case MISCREG_CLEANWIN:
          cleanwin = val;
          break;
        case MISCREG_OTHERWIN:
          otherwin = val;
          break;
        case MISCREG_WSTATE:
          wstate = val;
          break;
        case MISCREG_GL:
          gl = val;
          break;

        /** Hyper privileged registers */
        case MISCREG_HPSTATE:
          hpstate = val;
          break;
        case MISCREG_HTSTATE:
          htstate[tl-1] = val;
          break;
        case MISCREG_HINTP:
          panic("HINTP not implemented\n");
        case MISCREG_HTBA:
          htba = val;
          break;
        case MISCREG_STRAND_STS_REG:
          strandStatusReg = val;
          break;
        case MISCREG_HSTICK_CMPR:
          hstick_cmpr = val;
          break;

        /** Floating Point Status Register */
        case MISCREG_FSR:
          fsr = val;
          break;

        case MISCREG_MMU_P_CONTEXT:
          priContext = val;
          break;
        case MISCREG_MMU_S_CONTEXT:
          secContext = val;
          break;
        case MISCREG_MMU_PART_ID:
          partId = val;
          break;
        case MISCREG_MMU_LSU_CTRL:
          lsuCtrlReg = val;
          break;

        case MISCREG_MMU_ITLB_C0_TSB_PS0:
          iTlbC0TsbPs0 = val;
          break;
        case MISCREG_MMU_ITLB_C0_TSB_PS1:
          iTlbC0TsbPs1 = val;
          break;
        case MISCREG_MMU_ITLB_C0_CONFIG:
          iTlbC0Config = val;
          break;
        case MISCREG_MMU_ITLB_CX_TSB_PS0:
          iTlbCXTsbPs0 = val;
          break;
        case MISCREG_MMU_ITLB_CX_TSB_PS1:
          iTlbCXTsbPs1 = val;
          break;
        case MISCREG_MMU_ITLB_CX_CONFIG:
          iTlbCXConfig = val;
          break;
        case MISCREG_MMU_ITLB_SFSR:
          iTlbSfsr = val;
          break;
        case MISCREG_MMU_ITLB_TAG_ACCESS:
          iTlbTagAccess = val;
          break;

        case MISCREG_MMU_DTLB_C0_TSB_PS0:
          dTlbC0TsbPs0 = val;
          break;
        case MISCREG_MMU_DTLB_C0_TSB_PS1:
          dTlbC0TsbPs1 = val;
          break;
        case MISCREG_MMU_DTLB_C0_CONFIG:
          dTlbC0Config = val;
          break;
        case MISCREG_MMU_DTLB_CX_TSB_PS0:
          dTlbCXTsbPs0 = val;
          break;
        case MISCREG_MMU_DTLB_CX_TSB_PS1:
          dTlbCXTsbPs1 = val;
          break;
        case MISCREG_MMU_DTLB_CX_CONFIG:
          dTlbCXConfig = val;
          break;
        case MISCREG_MMU_DTLB_SFSR:
          dTlbSfsr = val;
          break;
        case MISCREG_MMU_DTLB_SFAR:
          dTlbSfar = val;
          break;
        case MISCREG_MMU_DTLB_TAG_ACCESS:
          dTlbTagAccess = val;
          break;

        case MISCREG_SCRATCHPAD_R0:
           scratchPad[0] = val;
        case MISCREG_SCRATCHPAD_R1:
           scratchPad[1] = val;
        case MISCREG_SCRATCHPAD_R2:
           scratchPad[2] = val;
        case MISCREG_SCRATCHPAD_R3:
           scratchPad[3] = val;
        case MISCREG_SCRATCHPAD_R4:
           scratchPad[4] = val;
        case MISCREG_SCRATCHPAD_R5:
           scratchPad[5] = val;
        case MISCREG_SCRATCHPAD_R6:
           scratchPad[6] = val;
        case MISCREG_SCRATCHPAD_R7:
           scratchPad[7] = val;

        default:
          panic("Miscellaneous register %d not implemented\n", miscReg);
    }
}

void MiscRegFile::setRegWithEffect(int miscReg,
        const MiscReg &val, ThreadContext * tc)
{
    const uint64_t Bit64 = (1ULL << 63);
#if FULL_SYSTEM
    uint64_t time;
    SparcSystem *sys;
#endif
    switch (miscReg) {
        case MISCREG_TICK:
          tick = tc->getCpuPtr()->curCycle() - val  & ~Bit64;
          tick |= val & Bit64;
          break;
        case MISCREG_FPRS:
          //Configure the fpu based on the fprs
          break;
        case MISCREG_PCR:
          //Set up performance counting based on pcr value
          break;
        case MISCREG_PSTATE:
          pstate = val;
          return;
        case MISCREG_TL:
          tl = val;
          return;
        case MISCREG_CWP:
          tc->changeRegFileContext(CONTEXT_CWP, val);
          break;
        case MISCREG_GL:
          tc->changeRegFileContext(CONTEXT_GLOBALS, val);
          break;
        case MISCREG_SOFTINT:
          //We need to inject interrupts, and or notify the interrupt
          //object that it needs to use a different interrupt level.
          //Any newly appropriate interrupts will happen when the cpu gets
          //around to checking for them. This might not be quite what we
          //want.
          break;
        case MISCREG_SOFTINT_CLR:
          //Do whatever this is supposed to do...
          break;
        case MISCREG_SOFTINT_SET:
          //Do whatever this is supposed to do...
          break;
#if FULL_SYSTEM
        case MISCREG_TICK_CMPR:
          if (tickCompare == NULL)
              tickCompare = new TickCompareEvent(this, tc);
          setReg(miscReg, val);
          if ((tick_cmpr & mask(63)) && tickCompare->scheduled())
                  tickCompare->deschedule();
          time = (tick_cmpr & mask(63)) - (tick & mask(63));
          if (!(tick_cmpr & ~mask(63)) && time > 0)
              tickCompare->schedule(time * tc->getCpuPtr()->cycles(1));
          break;
#endif
        case MISCREG_PIL:
          //We need to inject interrupts, and or notify the interrupt
          //object that it needs to use a different interrupt level.
          //Any newly appropriate interrupts will happen when the cpu gets
          //around to checking for them. This might not be quite what we
          //want.
          break;
//We'll include this only in FS so we don't need the SparcSystem type around
//in SE.
#if FULL_SYSTEM
        case MISCREG_STICK:
          sys = dynamic_cast<SparcSystem*>(tc->getSystemPtr());
          assert(sys != NULL);
          sys->sysTick = curTick/Clock::Int::ns - val & ~Bit64;
          stick |= val & Bit64;
          break;
        case MISCREG_STICK_CMPR:
          if (sTickCompare == NULL)
              sTickCompare = new STickCompareEvent(this, tc);
          sys = dynamic_cast<SparcSystem*>(tc->getSystemPtr());
          assert(sys != NULL);
          if ((stick_cmpr & ~mask(63)) && sTickCompare->scheduled())
                  sTickCompare->deschedule();
          time = (stick_cmpr & mask(63)) - sys->sysTick;
          if (!(stick_cmpr & ~mask(63)) && time > 0)
              sTickCompare->schedule(time * Clock::Int::ns);
          break;
        case MISCREG_HSTICK_CMPR:
          if (hSTickCompare == NULL)
              hSTickCompare = new HSTickCompareEvent(this, tc);
          sys = dynamic_cast<SparcSystem*>(tc->getSystemPtr());
          assert(sys != NULL);
          if ((hstick_cmpr & ~mask(63)) && hSTickCompare->scheduled())
                  hSTickCompare->deschedule();
          int64_t time = (hstick_cmpr & mask(63)) - sys->sysTick;
          if (!(hstick_cmpr & ~mask(63)) && time > 0)
              hSTickCompare->schedule(time * Clock::Int::ns);
          break;
#endif
    }
    setReg(miscReg, val);
}

void MiscRegFile::serialize(std::ostream & os)
{
    SERIALIZE_SCALAR(pstate);
    SERIALIZE_SCALAR(tba);
    SERIALIZE_SCALAR(y);
    SERIALIZE_SCALAR(pil);
    SERIALIZE_SCALAR(gl);
    SERIALIZE_SCALAR(cwp);
    SERIALIZE_ARRAY(tt, MaxTL);
    SERIALIZE_SCALAR(ccr);
    SERIALIZE_SCALAR(asi);
    SERIALIZE_SCALAR(tl);
    SERIALIZE_ARRAY(tpc, MaxTL);
    SERIALIZE_ARRAY(tnpc, MaxTL);
    SERIALIZE_ARRAY(tstate, MaxTL);
    SERIALIZE_SCALAR(tick);
    SERIALIZE_SCALAR(cansave);
    SERIALIZE_SCALAR(canrestore);
    SERIALIZE_SCALAR(otherwin);
    SERIALIZE_SCALAR(cleanwin);
    SERIALIZE_SCALAR(wstate);
    SERIALIZE_SCALAR(fsr);
    SERIALIZE_SCALAR(fprs);
    SERIALIZE_SCALAR(hpstate);
    SERIALIZE_ARRAY(htstate, MaxTL);
    SERIALIZE_SCALAR(htba);
    SERIALIZE_SCALAR(hstick_cmpr);
    SERIALIZE_SCALAR(strandStatusReg);
    SERIALIZE_SCALAR(priContext);
    SERIALIZE_SCALAR(secContext);
    SERIALIZE_SCALAR(partId);
    SERIALIZE_SCALAR(lsuCtrlReg);
    SERIALIZE_SCALAR(iTlbC0TsbPs0);
    SERIALIZE_SCALAR(iTlbC0TsbPs1);
    SERIALIZE_SCALAR(iTlbC0Config);
    SERIALIZE_SCALAR(iTlbCXTsbPs0);
    SERIALIZE_SCALAR(iTlbCXTsbPs1);
    SERIALIZE_SCALAR(iTlbCXConfig);
    SERIALIZE_SCALAR(iTlbSfsr);
    SERIALIZE_SCALAR(iTlbTagAccess);
    SERIALIZE_SCALAR(dTlbC0TsbPs0);
    SERIALIZE_SCALAR(dTlbC0TsbPs1);
    SERIALIZE_SCALAR(dTlbC0Config);
    SERIALIZE_SCALAR(dTlbCXTsbPs0);
    SERIALIZE_SCALAR(dTlbCXTsbPs1);
    SERIALIZE_SCALAR(dTlbSfsr);
    SERIALIZE_SCALAR(dTlbSfar);
    SERIALIZE_SCALAR(dTlbTagAccess);
    SERIALIZE_ARRAY(scratchPad,8);
}

void MiscRegFile::unserialize(Checkpoint * cp, const std::string & section)
{
    UNSERIALIZE_SCALAR(pstate);
    UNSERIALIZE_SCALAR(tba);
    UNSERIALIZE_SCALAR(y);
    UNSERIALIZE_SCALAR(pil);
    UNSERIALIZE_SCALAR(gl);
    UNSERIALIZE_SCALAR(cwp);
    UNSERIALIZE_ARRAY(tt, MaxTL);
    UNSERIALIZE_SCALAR(ccr);
    UNSERIALIZE_SCALAR(asi);
    UNSERIALIZE_SCALAR(tl);
    UNSERIALIZE_ARRAY(tpc, MaxTL);
    UNSERIALIZE_ARRAY(tnpc, MaxTL);
    UNSERIALIZE_ARRAY(tstate, MaxTL);
    UNSERIALIZE_SCALAR(tick);
    UNSERIALIZE_SCALAR(cansave);
    UNSERIALIZE_SCALAR(canrestore);
    UNSERIALIZE_SCALAR(otherwin);
    UNSERIALIZE_SCALAR(cleanwin);
    UNSERIALIZE_SCALAR(wstate);
    UNSERIALIZE_SCALAR(fsr);
    UNSERIALIZE_SCALAR(fprs);
    UNSERIALIZE_SCALAR(hpstate);
    UNSERIALIZE_ARRAY(htstate, MaxTL);
    UNSERIALIZE_SCALAR(htba);
    UNSERIALIZE_SCALAR(hstick_cmpr);
    UNSERIALIZE_SCALAR(strandStatusReg);
    UNSERIALIZE_SCALAR(priContext);
    UNSERIALIZE_SCALAR(secContext);
    UNSERIALIZE_SCALAR(partId);
    UNSERIALIZE_SCALAR(lsuCtrlReg);
    UNSERIALIZE_SCALAR(iTlbC0TsbPs0);
    UNSERIALIZE_SCALAR(iTlbC0TsbPs1);
    UNSERIALIZE_SCALAR(iTlbC0Config);
    UNSERIALIZE_SCALAR(iTlbCXTsbPs0);
    UNSERIALIZE_SCALAR(iTlbCXTsbPs1);
    UNSERIALIZE_SCALAR(iTlbCXConfig);
    UNSERIALIZE_SCALAR(iTlbSfsr);
    UNSERIALIZE_SCALAR(iTlbTagAccess);
    UNSERIALIZE_SCALAR(dTlbC0TsbPs0);
    UNSERIALIZE_SCALAR(dTlbC0TsbPs1);
    UNSERIALIZE_SCALAR(dTlbC0Config);
    UNSERIALIZE_SCALAR(dTlbCXTsbPs0);
    UNSERIALIZE_SCALAR(dTlbCXTsbPs1);
    UNSERIALIZE_SCALAR(dTlbSfsr);
    UNSERIALIZE_SCALAR(dTlbSfar);
    UNSERIALIZE_SCALAR(dTlbTagAccess);
    UNSERIALIZE_ARRAY(scratchPad,8);}

#if FULL_SYSTEM
void
MiscRegFile::processTickCompare(ThreadContext *tc)
{
    panic("tick compare not implemented\n");
}

void
MiscRegFile::processSTickCompare(ThreadContext *tc)
{
    panic("tick compare not implemented\n");
}

void
MiscRegFile::processHSTickCompare(ThreadContext *tc)
{
    panic("tick compare not implemented\n");
}
#endif