summaryrefslogtreecommitdiff
path: root/src/arch/arm/utility.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/arm/utility.cc')
-rw-r--r--src/arch/arm/utility.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/arch/arm/utility.cc b/src/arch/arm/utility.cc
index a114ec5e0..c42a8dddd 100644
--- a/src/arch/arm/utility.cc
+++ b/src/arch/arm/utility.cc
@@ -133,5 +133,22 @@ skipFunction(ThreadContext *tc)
tc->pcState(newPC);
}
+void
+copyRegs(ThreadContext *src, ThreadContext *dest)
+{
+ int i;
+ for(i = 0; i < TheISA::NumIntRegs; i++)
+ dest->setIntReg(i, src->readIntReg(i));
+ for(i = 0; i < TheISA::NumFloatRegs; i++)
+ dest->setFloatReg(i, src->readFloatReg(i));
+ for(i = 0; i < TheISA::NumMiscRegs; i++)
+ dest->setMiscRegNoEffect(i, src->readMiscRegNoEffect(i));
+ // setMiscReg "with effect" will set the misc register mapping correctly.
+ // e.g. updateRegMap(val)
+ dest->setMiscReg(MISCREG_CPSR, src->readMiscRegNoEffect(MISCREG_CPSR));
+
+ // Lastly copy PC/NPC
+ dest->pcState(src->pcState());
+}
}