summaryrefslogtreecommitdiff
path: root/src/sim/drain.hh
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2015-07-07 09:51:04 +0100
committerAndreas Sandberg <andreas.sandberg@arm.com>2015-07-07 09:51:04 +0100
commite9c3d59aae58f8fcf77ce5cf4b985dc9e2a90de2 (patch)
tree799c50d9a0b99f1623a16d9c1d49f4cb0d1fcbaf /src/sim/drain.hh
parent1dc5e63b889647a153f01351f560a3beaa41f293 (diff)
downloadgem5-e9c3d59aae58f8fcf77ce5cf4b985dc9e2a90de2.tar.xz
sim: Make the drain state a global typed enum
The drain state enum is currently a part of the Drainable interface. The same state machine will be used by the DrainManager to identify the global state of the simulator. Make the drain state a global typed enum to better cater for this usage scenario.
Diffstat (limited to 'src/sim/drain.hh')
-rw-r--r--src/sim/drain.hh62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/sim/drain.hh b/src/sim/drain.hh
index 6f0769f34..ae80fb7e9 100644
--- a/src/sim/drain.hh
+++ b/src/sim/drain.hh
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012 ARM Limited
+ * Copyright (c) 2012, 2015 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -45,7 +45,33 @@
#include "base/flags.hh"
-class Event;
+class Drainable;
+
+#ifndef SWIG // SWIG doesn't support strongly typed enums
+/**
+ * Object drain/handover states
+ *
+ * An object starts out in the Running state. When the simulator
+ * prepares to take a snapshot or prepares a CPU for handover, it
+ * calls the drain() method to transfer the object into the Draining
+ * or Drained state. If any object enters the Draining state
+ * (Drainable::drain() returning >0), simulation continues until it
+ * all objects have entered the Drained state.
+ *
+ * Before resuming simulation, the simulator calls resume() to
+ * transfer the object to the Running state.
+ *
+ * \note Even though the state of an object (visible to the rest of
+ * the world through Drainable::getState()) could be used to determine
+ * if all objects have entered the Drained state, the protocol is
+ * actually a bit more elaborate. See Drainable::drain() for details.
+ */
+enum class DrainState {
+ Running, /** Running normally */
+ Draining, /** Draining buffers pending serialization/handover */
+ Drained /** Buffers drained, ready for serialization/handover */
+};
+#endif
/**
* This class coordinates draining of a System.
@@ -141,30 +167,6 @@ class DrainManager
class Drainable
{
public:
- /**
- * Object drain/handover states
- *
- * An object starts out in the Running state. When the simulator
- * prepares to take a snapshot or prepares a CPU for handover, it
- * calls the drain() method to transfer the object into the
- * Draining or Drained state. If any object enters the Draining
- * state (drain() returning >0), simulation continues until it all
- * objects have entered the Drained state.
- *
- * Before resuming simulation, the simulator calls resume() to
- * transfer the object to the Running state.
- *
- * \note Even though the state of an object (visible to the rest
- * of the world through getState()) could be used to determine if
- * all objects have entered the Drained state, the protocol is
- * actually a bit more elaborate. See drain() for details.
- */
- enum State {
- Running, /** Running normally */
- Draining, /** Draining buffers pending serialization/handover */
- Drained /** Buffers drained, ready for serialization/handover */
- };
-
Drainable();
virtual ~Drainable();
@@ -225,15 +227,13 @@ class Drainable
*/
virtual void memInvalidate() {};
- State getDrainState() const { return _drainState; }
+ DrainState getDrainState() const { return _drainState; }
protected:
- void setDrainState(State new_state) { _drainState = new_state; }
-
+ void setDrainState(DrainState new_state) { _drainState = new_state; }
private:
- State _drainState;
-
+ DrainState _drainState;
};
DrainManager *createDrainManager();