Deleted Added
sdiff udiff text old ( 9554:406fbcf60223 ) new ( 10910:32f3d1c454ec )
full compact
1/*
2 * Copyright (c) 2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

--- 29 unchanged lines hidden (view full) ---

40#ifndef __SIM_DRAIN_HH__
41#define __SIM_DRAIN_HH__
42
43#include <cassert>
44#include <vector>
45
46#include "base/flags.hh"
47
48class Event;
49
50/**
51 * This class coordinates draining of a System.
52 *
53 * When draining a System, we need to make sure that all SimObjects in
54 * that system have drained their state before declaring the operation
55 * to be successful. This class keeps track of how many objects are
56 * still in the process of draining their state. Once it determines
57 * that all objects have drained their state, it exits the simulation
58 * loop.

--- 77 unchanged lines hidden (view full) ---

136 *
137 * <li>Call Drainable::drainResume() and continue the simulation.
138 * </ol>
139 *
140 */
141class Drainable
142{
143 public:
144 /**
145 * Object drain/handover states
146 *
147 * An object starts out in the Running state. When the simulator
148 * prepares to take a snapshot or prepares a CPU for handover, it
149 * calls the drain() method to transfer the object into the
150 * Draining or Drained state. If any object enters the Draining
151 * state (drain() returning >0), simulation continues until it all
152 * objects have entered the Drained state.
153 *
154 * Before resuming simulation, the simulator calls resume() to
155 * transfer the object to the Running state.
156 *
157 * \note Even though the state of an object (visible to the rest
158 * of the world through getState()) could be used to determine if
159 * all objects have entered the Drained state, the protocol is
160 * actually a bit more elaborate. See drain() for details.
161 */
162 enum State {
163 Running, /** Running normally */
164 Draining, /** Draining buffers pending serialization/handover */
165 Drained /** Buffers drained, ready for serialization/handover */
166 };
167
168 Drainable();
169 virtual ~Drainable();
170
171 /**
172 * Determine if an object needs draining and register a
173 * DrainManager.
174 *
175 * When draining the state of an object, the simulator calls drain

--- 44 unchanged lines hidden (view full) ---

220 * that might become stale when we return. This method is used to
221 * flush all such state back to main memory.
222 *
223 * @warn This does <i>not</i> cause any dirty state to be written
224 * back to memory.
225 */
226 virtual void memInvalidate() {};
227
228 State getDrainState() const { return _drainState; }
229
230 protected:
231 void setDrainState(State new_state) { _drainState = new_state; }
232
233
234 private:
235 State _drainState;
236
237};
238
239DrainManager *createDrainManager();
240void cleanupDrainManager(DrainManager *drain_manager);
241
242#endif