registers.hh revision 6321
1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution; 12 * neither the name of the copyright holders nor the names of its 13 * contributors may be used to endorse or promote products derived from 14 * this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * Authors: Gabe Black 29 */ 30 31#ifndef __ARCH_ALPHA_REGFILE_HH__ 32#define __ARCH_ALPHA_REGFILE_HH__ 33 34#include "arch/alpha/isa_traits.hh" 35#include "arch/alpha/miscregfile.hh" 36#include "arch/alpha/types.hh" 37#include "arch/alpha/mt.hh" 38#include "sim/faults.hh" 39 40#include <string> 41 42//XXX These should be implemented by someone who knows the alpha stuff better 43 44class Checkpoint; 45class EventManager; 46class ThreadContext; 47 48namespace AlphaISA { 49 50// redirected register map, really only used for the full system case. 51extern const int reg_redir[NumIntRegs]; 52 53class RegFile { 54 protected: 55 Addr pc; // program counter 56 Addr npc; // next-cycle program counter 57 Addr nnpc; // next next-cycle program counter 58 59 public: 60 Addr 61 readPC() 62 { 63 return pc; 64 } 65 66 void 67 setPC(Addr val) 68 { 69 pc = val; 70 } 71 72 Addr 73 readNextPC() 74 { 75 return npc; 76 } 77 78 void 79 setNextPC(Addr val) 80 { 81 npc = val; 82 } 83 84 Addr 85 readNextNPC() 86 { 87 return npc + sizeof(MachInst); 88 } 89 90 void 91 setNextNPC(Addr val) 92 { } 93 94 public: 95#if FULL_SYSTEM 96 int intrflag; // interrupt flag 97#endif // FULL_SYSTEM 98 99 void 100 clear() 101 { 102 } 103 104 void serialize(EventManager *em, std::ostream &os); 105 void unserialize(EventManager *em, Checkpoint *cp, 106 const std::string §ion); 107}; 108 109void copyRegs(ThreadContext *src, ThreadContext *dest); 110 111void copyMiscRegs(ThreadContext *src, ThreadContext *dest); 112 113} // namespace AlphaISA 114 115#endif // __ARCH_ALPHA_REGFILE_HH__ 116