Have a copyRegs function defined in the ISA that copies registers from one ExecContext to another ExecContext. This makes it easier for anything that needs to copy architected registers to do so in an ISA independent fashion.
arch/alpha/ev5.cc: copyIprs now copies from a source ExecContext to a destination ExecContext. arch/alpha/registerfile.hh: Have ISA specific functions to copy all architected registers from one ExecContext to another. cpu/cpu_exec_context.cc: Call the ISA in order to copy any architected registers. --HG-- extra : convert_revision : 056cc3b3a9f345535d5a57c6524b114bbd5ae3c8
This commit is contained in:
parent
af975813e5
commit
f045b110cf
3 changed files with 12 additions and 24 deletions
|
@ -542,10 +542,10 @@ AlphaISA::MiscRegFile::setIpr(int idx, uint64_t val, ExecContext *xc)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AlphaISA::MiscRegFile::copyIprs(ExecContext *xc)
|
AlphaISA::copyIprs(ExecContext *src, ExecContext *dest)
|
||||||
{
|
{
|
||||||
for (int i = IPR_Base_DepTag; i < NumInternalProcRegs; ++i) {
|
for (int i = IPR_Base_DepTag; i < NumInternalProcRegs; ++i) {
|
||||||
ipr[i] = xc->readMiscReg(i);
|
dest->setMiscReg(i, src->readMiscReg(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "sim/faults.hh"
|
#include "sim/faults.hh"
|
||||||
|
|
||||||
class Checkpoint;
|
class Checkpoint;
|
||||||
|
class ExecContext;
|
||||||
|
|
||||||
namespace AlphaISA
|
namespace AlphaISA
|
||||||
{
|
{
|
||||||
|
@ -67,8 +68,6 @@ namespace AlphaISA
|
||||||
Fault setRegWithEffect(int misc_reg, const MiscReg &val,
|
Fault setRegWithEffect(int misc_reg, const MiscReg &val,
|
||||||
ExecContext *xc);
|
ExecContext *xc);
|
||||||
|
|
||||||
void copyMiscRegs(ExecContext *xc);
|
|
||||||
|
|
||||||
#if FULL_SYSTEM
|
#if FULL_SYSTEM
|
||||||
protected:
|
protected:
|
||||||
typedef uint64_t InternalProcReg;
|
typedef uint64_t InternalProcReg;
|
||||||
|
@ -79,8 +78,6 @@ namespace AlphaISA
|
||||||
InternalProcReg readIpr(int idx, Fault &fault, ExecContext *xc);
|
InternalProcReg readIpr(int idx, Fault &fault, ExecContext *xc);
|
||||||
|
|
||||||
Fault setIpr(int idx, InternalProcReg val, ExecContext *xc);
|
Fault setIpr(int idx, InternalProcReg val, ExecContext *xc);
|
||||||
|
|
||||||
void copyIprs(ExecContext *xc);
|
|
||||||
#endif
|
#endif
|
||||||
friend class RegFile;
|
friend class RegFile;
|
||||||
};
|
};
|
||||||
|
@ -105,6 +102,13 @@ namespace AlphaISA
|
||||||
void unserialize(Checkpoint *cp, const std::string §ion);
|
void unserialize(Checkpoint *cp, const std::string §ion);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void copyRegs(ExecContext *src, ExecContext *dest);
|
||||||
|
|
||||||
|
void copyMiscRegs(ExecContext *src, ExecContext *dest);
|
||||||
|
|
||||||
|
#if FULL_SYSTEM
|
||||||
|
void copyIprs(ExecContext *src, ExecContext *dest);
|
||||||
|
#endif
|
||||||
} // namespace AlphaISA
|
} // namespace AlphaISA
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "arch/isa_traits.hh"
|
||||||
#include "cpu/base.hh"
|
#include "cpu/base.hh"
|
||||||
#include "cpu/cpu_exec_context.hh"
|
#include "cpu/cpu_exec_context.hh"
|
||||||
#include "cpu/exec_context.hh"
|
#include "cpu/exec_context.hh"
|
||||||
|
@ -269,23 +270,6 @@ CPUExecContext::regStats(const string &name)
|
||||||
void
|
void
|
||||||
CPUExecContext::copyArchRegs(ExecContext *xc)
|
CPUExecContext::copyArchRegs(ExecContext *xc)
|
||||||
{
|
{
|
||||||
// First loop through the integer registers.
|
TheISA::copyRegs(xc, proxy);
|
||||||
for (int i = 0; i < TheISA::NumIntRegs; ++i) {
|
|
||||||
setIntReg(i, xc->readIntReg(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then loop through the floating point registers.
|
|
||||||
for (int i = 0; i < TheISA::NumFloatRegs; ++i) {
|
|
||||||
setFloatRegDouble(i, xc->readFloatRegDouble(i));
|
|
||||||
setFloatRegInt(i, xc->readFloatRegInt(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy misc. registers
|
|
||||||
regs.miscRegs.copyMiscRegs(xc);
|
|
||||||
|
|
||||||
// Lastly copy PC/NPC
|
|
||||||
setPC(xc->readPC());
|
|
||||||
setNextPC(xc->readNextPC());
|
|
||||||
setNextNPC(xc->readNextNPC());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue