summaryrefslogtreecommitdiff
path: root/src/cpu/base.hh
diff options
context:
space:
mode:
authorAndreas Sandberg <Andreas.Sandberg@arm.com>2012-09-25 11:49:40 -0500
committerAndreas Sandberg <Andreas.Sandberg@arm.com>2012-09-25 11:49:40 -0500
commit6598241f2c188ba6f4ce035d9e1fbdd4619c7e00 (patch)
treea9785f2f7fd62f92916eb8f3900ad0427b96396d /src/cpu/base.hh
parent5f32eceeda92f45d253a0835c6643e786a91ba49 (diff)
downloadgem5-6598241f2c188ba6f4ce035d9e1fbdd4619c7e00.tar.xz
sim: Move CPU-specific methods from SimObject to the BaseCPU class
Diffstat (limited to 'src/cpu/base.hh')
-rw-r--r--src/cpu/base.hh24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/cpu/base.hh b/src/cpu/base.hh
index 82864ae7b..0c1d19856 100644
--- a/src/cpu/base.hh
+++ b/src/cpu/base.hh
@@ -278,13 +278,27 @@ class BaseCPU : public MemObject
void registerThreadContexts();
- /// Prepare for another CPU to take over execution. When it is
- /// is ready (drained pipe) it signals the sampler.
+ /**
+ * Prepare for another CPU to take over execution.
+ *
+ * When this method exits, all internal state should have been
+ * flushed. After the method returns, the simulator calls
+ * takeOverFrom() on the new CPU with this CPU as its parameter.
+ */
virtual void switchOut();
- /// Take over execution from the given CPU. Used for warm-up and
- /// sampling.
- virtual void takeOverFrom(BaseCPU *);
+ /**
+ * Load the state of a CPU from the previous CPU object, invoked
+ * on all new CPUs that are about to be switched in.
+ *
+ * A CPU model implementing this method is expected to initialize
+ * its state from the old CPU and connect its memory (unless they
+ * are already connected) to the memories connected to the old
+ * CPU.
+ *
+ * @param cpu CPU to initialize read state from.
+ */
+ virtual void takeOverFrom(BaseCPU *cpu);
/**
* Number of threads we're actually simulating (<= SMT_MAX_THREADS).