{
int gl = tc->readMiscRegNoEffect(MISCREG_GL);
int cwp = tc->readMiscRegNoEffect(MISCREG_CWP);
- //DPRINTF(Sparc, "Global Level = %d, Current Window Pointer = %d\n", gl, cwp);
+ //DPRINTF(RegisterWindows, "Global Level = %d, Current Window Pointer = %d\n", gl, cwp);
int newReg;
//The total number of global registers
int numGlobals = (MaxGL + 1) * 8;
}
else
panic("Tried to flatten invalid register index %d!\n", reg);
- DPRINTF(Sparc, "Flattened register %d to %d.\n", reg, newReg);
+ DPRINTF(RegisterWindows, "Flattened register %d to %d.\n", reg, newReg);
return newReg;
//return intRegFile.flattenIndex(reg);
}
UNSERIALIZE_SCALAR(nnpc);
}
-void RegFile::changeContext(RegContextParam param, RegContextVal val)
-{
- switch(param)
- {
- case CONTEXT_CWP:
- intRegFile.setCWP(val);
- break;
- case CONTEXT_GLOBALS:
- intRegFile.setGlobals(val);
- break;
- default:
- panic("Tried to set illegal context parameter in the SPARC regfile.\n");
- }
-}
-
void SparcISA::copyMiscRegs(ThreadContext *src, ThreadContext *dest)
{
void SparcISA::copyRegs(ThreadContext *src, ThreadContext *dest)
{
- // First loop through the integer registers.
- for (int i = 0; i < SparcISA::NumIntRegs; ++i) {
- dest->setIntReg(i, src->readIntReg(i));
+ //First loop through the integer registers.
+ int old_gl = src->readMiscRegNoEffect(MISCREG_GL);
+ int old_cwp = src->readMiscRegNoEffect(MISCREG_CWP);
+ //Globals
+ for (int x = 0; x < MaxGL; ++x) {
+ src->setMiscRegNoEffect(MISCREG_GL, x);
+ dest->setMiscRegNoEffect(MISCREG_GL, x);
+ for (int y = 0; y < 8; y++)
+ dest->setIntReg(y, src->readIntReg(y));
}
+ //Locals/Ins/Outs
+ for (int x = 0; x < NWindows; ++x) {
+ src->setMiscRegNoEffect(MISCREG_CWP, x);
+ dest->setMiscRegNoEffect(MISCREG_CWP, x);
+ for (int y = 8; y < 32; y++)
+ dest->setIntReg(y, src->readIntReg(y));
+ }
+ //MicroIntRegs
+ for (int y = 0; y < NumMicroIntRegs; ++y)
+ dest->setIntReg(y+32, src->readIntReg(y+32));
+
+ //Restore src's GL, CWP
+ src->setMiscRegNoEffect(MISCREG_GL, old_gl);
+ src->setMiscRegNoEffect(MISCREG_CWP, old_cwp);
+
// Then loop through the floating point registers.
for (int i = 0; i < SparcISA::NumFloatRegs; ++i) {
// Copy misc. registers
copyMiscRegs(src, dest);
+
// Lastly copy PC/NPC
dest->setPC(src->readPC());
dest->setNextPC(src->readNextPC());
dest->setNextNPC(src->readNextNPC());
}
+