diff options
author | Christopher Torng <clt67@cornell.edu> | 2014-03-01 23:35:23 -0600 |
---|---|---|
committer | Christopher Torng <clt67@cornell.edu> | 2014-03-01 23:35:23 -0600 |
commit | 919baa603d0b835c3202f9968a617a31f9116549 (patch) | |
tree | e5e075957313bbe9a9630b84e64c86545351e264 /src/arch/mips | |
parent | a533f3f9831081625626f96f9434a00f3079e98e (diff) | |
download | gem5-919baa603d0b835c3202f9968a617a31f9116549.tar.xz |
cpu: Enable fast-forwarding for MIPS InOrderCPU and O3CPU
A copyRegs() function is added to MIPS utilities
to copy architectural state from the old CPU to
the new CPU during fast-forwarding. This
addition alone enables fast-forwarding for the
o3 cpu model running MIPS.
The patch also adds takeOverFrom() and
drainResume() functions to the InOrderCPU to
enable it to take over from another CPU. This
change enables fast-forwarding for the inorder
cpu model running MIPS, but not for Alpha.
Committed by: Nilay Vaish <nilay@cs.wisc.edu>
Diffstat (limited to 'src/arch/mips')
-rw-r--r-- | src/arch/mips/utility.cc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/arch/mips/utility.cc b/src/arch/mips/utility.cc index f84819756..ff410bad1 100644 --- a/src/arch/mips/utility.cc +++ b/src/arch/mips/utility.cc @@ -241,7 +241,23 @@ initCPU(ThreadContext *tc, int cpuId) void copyRegs(ThreadContext *src, ThreadContext *dest) { - panic("Copy Regs Not Implemented Yet\n"); + // First loop through the integer registers. + for (int i = 0; i < NumIntRegs; i++) + dest->setIntRegFlat(i, src->readIntRegFlat(i)); + + // Then loop through the floating point registers. + for (int i = 0; i < NumFloatRegs; i++) + dest->setFloatRegFlat(i, src->readFloatRegFlat(i)); + + // Would need to add condition-code regs if implemented + assert(NumCCRegs == 0); + + // Copy misc. registers + for (int i = 0; i < NumMiscRegs; i++) + dest->setMiscRegNoEffect(i, src->readMiscRegNoEffect(i)); + + // Copy over the PC State + dest->pcState(src->pcState()); } void |