From 43345bff6c4ee2fd5a35760776898eefa690329e Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 8 Jul 2009 23:02:21 -0700 Subject: Registers: Move the PCs out of the ISAs and into the CPUs. --- src/arch/alpha/regfile.cc | 4 -- src/arch/alpha/regfile.hh | 44 ---------------- src/arch/arm/regfile/regfile.cc | 14 ----- src/arch/arm/regfile/regfile.hh | 42 ++------------- src/arch/mips/SConscript | 1 - src/arch/mips/regfile/regfile.cc | 109 --------------------------------------- src/arch/mips/regfile/regfile.hh | 38 +++++--------- src/arch/sparc/regfile.cc | 50 ------------------ src/arch/sparc/regfile.hh | 26 ++-------- src/arch/x86/regfile.cc | 37 ------------- src/arch/x86/regfile.hh | 20 +------ 11 files changed, 23 insertions(+), 362 deletions(-) delete mode 100644 src/arch/mips/regfile/regfile.cc (limited to 'src/arch') diff --git a/src/arch/alpha/regfile.cc b/src/arch/alpha/regfile.cc index 9a9ac41a7..15df83859 100644 --- a/src/arch/alpha/regfile.cc +++ b/src/arch/alpha/regfile.cc @@ -55,8 +55,6 @@ const int reg_redir[NumIntRegs] = { void RegFile::serialize(EventManager *em, ostream &os) { - SERIALIZE_SCALAR(pc); - SERIALIZE_SCALAR(npc); #if FULL_SYSTEM SERIALIZE_SCALAR(intrflag); #endif @@ -65,8 +63,6 @@ RegFile::serialize(EventManager *em, ostream &os) void RegFile::unserialize(EventManager *em, Checkpoint *cp, const string §ion) { - UNSERIALIZE_SCALAR(pc); - UNSERIALIZE_SCALAR(npc); #if FULL_SYSTEM UNSERIALIZE_SCALAR(intrflag); #endif diff --git a/src/arch/alpha/regfile.hh b/src/arch/alpha/regfile.hh index accb06302..39c56e57a 100644 --- a/src/arch/alpha/regfile.hh +++ b/src/arch/alpha/regfile.hh @@ -32,10 +32,6 @@ #define __ARCH_ALPHA_REGFILE_HH__ #include "arch/alpha/isa_traits.hh" -#include "arch/alpha/miscregfile.hh" -#include "arch/alpha/types.hh" -#include "arch/alpha/mt.hh" -#include "sim/faults.hh" #include @@ -51,46 +47,6 @@ namespace AlphaISA { extern const int reg_redir[NumIntRegs]; class RegFile { - protected: - Addr pc; // program counter - Addr npc; // next-cycle program counter - Addr nnpc; // next next-cycle program counter - - public: - Addr - readPC() - { - return pc; - } - - void - setPC(Addr val) - { - pc = val; - } - - Addr - readNextPC() - { - return npc; - } - - void - setNextPC(Addr val) - { - npc = val; - } - - Addr - readNextNPC() - { - return npc + sizeof(MachInst); - } - - void - setNextNPC(Addr val) - { } - public: #if FULL_SYSTEM int intrflag; // interrupt flag diff --git a/src/arch/arm/regfile/regfile.cc b/src/arch/arm/regfile/regfile.cc index a0365e3d3..2d995df93 100644 --- a/src/arch/arm/regfile/regfile.cc +++ b/src/arch/arm/regfile/regfile.cc @@ -55,18 +55,4 @@ MiscRegFile::copyMiscRegs(ThreadContext *tc) panic("Copy Misc. Regs Not Implemented Yet\n"); } -void -RegFile::serialize(EventManager *em, ostream &os) -{ - SERIALIZE_SCALAR(npc); - SERIALIZE_SCALAR(nnpc); -} - -void -RegFile::unserialize(EventManager *em, Checkpoint *cp, const string §ion) -{ - UNSERIALIZE_SCALAR(npc); - UNSERIALIZE_SCALAR(nnpc); -} - } // namespace ArmISA diff --git a/src/arch/arm/regfile/regfile.hh b/src/arch/arm/regfile/regfile.hh index 69d4252a6..cd2d4ee2c 100644 --- a/src/arch/arm/regfile/regfile.hh +++ b/src/arch/arm/regfile/regfile.hh @@ -99,46 +99,12 @@ namespace ArmISA void clear() {} - protected: - Addr pc; // program counter - Addr npc; // next-cycle program counter - Addr nnpc; // next-next-cycle program counter - - public: - Addr readPC() - { - return pc; - } - - void setPC(Addr val) - { - pc = val; - } - - Addr readNextPC() - { - return npc; - } - - void setNextPC(Addr val) - { - npc = val; - } - - Addr readNextNPC() - { - return npc + sizeof(MachInst); - } - - void setNextNPC(Addr val) - { - //nnpc = val; - } - - void serialize(EventManager *em, std::ostream &os); + void serialize(EventManager *em, std::ostream &os) + {} void unserialize(EventManager *em, Checkpoint *cp, - const std::string §ion); + const std::string §ion) + {} }; void copyRegs(ThreadContext *src, ThreadContext *dest); diff --git a/src/arch/mips/SConscript b/src/arch/mips/SConscript index 0b5f10611..7b54b853d 100644 --- a/src/arch/mips/SConscript +++ b/src/arch/mips/SConscript @@ -36,7 +36,6 @@ if env['TARGET_ISA'] == 'mips': Source('faults.cc') Source('isa.cc') Source('regfile/misc_regfile.cc') - Source('regfile/regfile.cc') Source('tlb.cc') Source('pagetable.cc') Source('utility.cc') diff --git a/src/arch/mips/regfile/regfile.cc b/src/arch/mips/regfile/regfile.cc deleted file mode 100644 index a19962ff3..000000000 --- a/src/arch/mips/regfile/regfile.cc +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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 - * Korey Sewell - */ - -#include "arch/mips/regfile/regfile.hh" -#include "sim/serialize.hh" - -using namespace std; - -namespace MipsISA -{ - -void -RegFile::clear() -{ -} - -void -RegFile::reset(std::string core_name, ThreadID num_threads, unsigned num_vpes, - BaseCPU *_cpu) -{ -} - -void -RegFile::setShadowSet(int css){ -} - - -Addr -RegFile::readPC() -{ - return pc; -} - -void -RegFile::setPC(Addr val) -{ - pc = val; -} - -Addr -RegFile::readNextPC() -{ - return npc; -} - -void -RegFile::setNextPC(Addr val) -{ - npc = val; -} - -Addr -RegFile::readNextNPC() -{ - return nnpc; -} - -void -RegFile::setNextNPC(Addr val) -{ - nnpc = val; -} - -void -RegFile::serialize(EventManager *em, std::ostream &os) -{ - SERIALIZE_SCALAR(pc); - SERIALIZE_SCALAR(npc); - SERIALIZE_SCALAR(nnpc); -} - -void -RegFile::unserialize(EventManager *em, Checkpoint *cp, - const std::string §ion) -{ - UNSERIALIZE_SCALAR(pc); - UNSERIALIZE_SCALAR(npc); - UNSERIALIZE_SCALAR(nnpc); -} - -} // namespace MipsISA diff --git a/src/arch/mips/regfile/regfile.hh b/src/arch/mips/regfile/regfile.hh index 28d295022..71775edc4 100644 --- a/src/arch/mips/regfile/regfile.hh +++ b/src/arch/mips/regfile/regfile.hh @@ -32,11 +32,10 @@ #ifndef __ARCH_MIPS_REGFILE_REGFILE_HH__ #define __ARCH_MIPS_REGFILE_REGFILE_HH__ -#include "arch/mips/types.hh" +#include +#include + #include "arch/mips/isa_traits.hh" -//#include "arch/mips/mt.hh" -//#include "cpu/base.hh" -#include "sim/faults.hh" class BaseCPU; class Checkpoint; @@ -95,33 +94,22 @@ namespace MipsISA class RegFile { - protected: - Addr pc; // program counter - Addr npc; // next-cycle program counter - Addr nnpc; // next-next-cycle program counter - // used to implement branch delay slot - // not real register - public: - void clear(); + void clear() + {} void reset(std::string core_name, ThreadID num_threads, - unsigned num_vpes, BaseCPU *_cpu); + unsigned num_vpes, BaseCPU *_cpu) + {} - void setShadowSet(int css); + void setShadowSet(int css) + {} public: - Addr readPC(); - void setPC(Addr val); - - Addr readNextPC(); - void setNextPC(Addr val); - - Addr readNextNPC(); - void setNextNPC(Addr val); - - void serialize(EventManager *em, std::ostream &os); + void serialize(EventManager *em, std::ostream &os) + {} void unserialize(EventManager *em, Checkpoint *cp, - const std::string §ion); + const std::string §ion) + {} }; diff --git a/src/arch/sparc/regfile.cc b/src/arch/sparc/regfile.cc index 574deab6c..28ffc57aa 100644 --- a/src/arch/sparc/regfile.cc +++ b/src/arch/sparc/regfile.cc @@ -33,57 +33,7 @@ #include "arch/sparc/miscregfile.hh" #include "cpu/thread_context.hh" -class Checkpoint; - using namespace SparcISA; -using namespace std; - -//RegFile class methods -Addr RegFile::readPC() -{ - return pc; -} - -void RegFile::setPC(Addr val) -{ - pc = val; -} - -Addr RegFile::readNextPC() -{ - return npc; -} - -void RegFile::setNextPC(Addr val) -{ - npc = val; -} - -Addr RegFile::readNextNPC() -{ - return nnpc; -} - -void RegFile::setNextNPC(Addr val) -{ - nnpc = val; -} - -void -RegFile::serialize(EventManager *em, ostream &os) -{ - SERIALIZE_SCALAR(pc); - SERIALIZE_SCALAR(npc); - SERIALIZE_SCALAR(nnpc); -} - -void -RegFile::unserialize(EventManager *em, Checkpoint *cp, const string §ion) -{ - UNSERIALIZE_SCALAR(pc); - UNSERIALIZE_SCALAR(npc); - UNSERIALIZE_SCALAR(nnpc); -} void SparcISA::copyMiscRegs(ThreadContext *src, ThreadContext *dest) { diff --git a/src/arch/sparc/regfile.hh b/src/arch/sparc/regfile.hh index b468d568b..b0c2aabbd 100644 --- a/src/arch/sparc/regfile.hh +++ b/src/arch/sparc/regfile.hh @@ -32,12 +32,11 @@ #ifndef __ARCH_SPARC_REGFILE_HH__ #define __ARCH_SPARC_REGFILE_HH__ +#include #include #include "arch/sparc/miscregfile.hh" #include "arch/sparc/sparc_traits.hh" -#include "base/types.hh" -#include "sim/serialize.hh" class Checkpoint; class EventManager; @@ -50,31 +49,16 @@ namespace SparcISA class RegFile { - protected: - Addr pc; // Program Counter - Addr npc; // Next Program Counter - Addr nnpc; - - public: - Addr readPC(); - void setPC(Addr val); - - Addr readNextPC(); - void setNextPC(Addr val); - - Addr readNextNPC(); - void setNextNPC(Addr val); - public: void clear() {} - void serialize(EventManager *em, std::ostream &os); + void serialize(EventManager *em, std::ostream &os) + {} void unserialize(EventManager *em, Checkpoint *cp, - const std::string §ion); - - public: + const std::string §ion) + {} }; void copyRegs(ThreadContext *src, ThreadContext *dest); diff --git a/src/arch/x86/regfile.cc b/src/arch/x86/regfile.cc index 54bc0999d..67ef0b128 100644 --- a/src/arch/x86/regfile.cc +++ b/src/arch/x86/regfile.cc @@ -85,48 +85,11 @@ * Authors: Gabe Black */ -#include "arch/x86/floatregs.hh" #include "arch/x86/miscregs.hh" #include "arch/x86/regfile.hh" #include "base/trace.hh" -#include "sim/serialize.hh" #include "cpu/thread_context.hh" -class Checkpoint; - -using namespace X86ISA; -using namespace std; - -//RegFile class methods -Addr RegFile::readPC() -{ - return rip; -} - -void RegFile::setPC(Addr val) -{ - rip = val; -} - -Addr RegFile::readNextPC() -{ - return nextRip; -} - -void RegFile::setNextPC(Addr val) -{ - nextRip = val; -} - -Addr RegFile::readNextNPC() -{ - //There's no way to know how big the -next- instruction will be. - return nextRip + 1; -} - -void RegFile::setNextNPC(Addr val) -{ } - void X86ISA::copyMiscRegs(ThreadContext *src, ThreadContext *dest) { diff --git a/src/arch/x86/regfile.hh b/src/arch/x86/regfile.hh index b832cbe28..6c0dc757e 100644 --- a/src/arch/x86/regfile.hh +++ b/src/arch/x86/regfile.hh @@ -58,14 +58,12 @@ #ifndef __ARCH_X86_REGFILE_HH__ #define __ARCH_X86_REGFILE_HH__ +#include #include #include "arch/x86/intregs.hh" #include "arch/x86/miscregs.hh" -#include "arch/x86/isa_traits.hh" #include "arch/x86/x86_traits.hh" -#include "arch/x86/types.hh" -#include "base/types.hh" class Checkpoint; class EventManager; @@ -88,28 +86,12 @@ namespace X86ISA class RegFile { - protected: - Addr rip; //Program Counter - Addr nextRip; //Next Program Counter - public: - Addr readPC(); - void setPC(Addr val); - - Addr readNextPC(); - void setNextPC(Addr val); - - Addr readNextNPC(); - void setNextNPC(Addr val); - - public: - void clear() {} void serialize(EventManager *em, std::ostream &os) {} - void unserialize(EventManager *em, Checkpoint *cp, const std::string §ion) {} -- cgit v1.2.3