60,61d59
<
< class Checkpoint;
201a200,242
> class DeallocateContextEvent : public Event
> {
> private:
> /** Number of Thread to Activate */
> int tid;
>
> /** Pointer to the CPU. */
> FullO3CPU<Impl> *cpu;
>
> public:
> /** Constructs the event. */
> DeallocateContextEvent();
>
> /** Initialize Event */
> void init(int thread_num, FullO3CPU<Impl> *thread_cpu);
>
> /** Processes the event, calling activateThread() on the CPU. */
> void process();
>
> /** Returns the description of the event. */
> const char *description();
> };
>
> /** Schedule cpu to deallocate thread context.*/
> void scheduleDeallocateContextEvent(int tid, int delay)
> {
> // Schedule thread to activate, regardless of its current state.
> if (deallocateContextEvent[tid].squashed())
> deallocateContextEvent[tid].reschedule(curTick + cycles(delay));
> else if (!deallocateContextEvent[tid].scheduled())
> deallocateContextEvent[tid].schedule(curTick + cycles(delay));
> }
>
> /** Unschedule thread deallocation in CPU */
> void unscheduleDeallocateContextEvent(int tid)
> {
> if (deallocateContextEvent[tid].scheduled())
> deallocateContextEvent[tid].squash();
> }
>
> /** The tick event used for scheduling CPU ticks. */
> DeallocateContextEvent deallocateContextEvent[Impl::MaxThreads];
>
211,213d251
< /** Returns a specific port. */
< Port *getPort(const std::string &if_name, int idx);
<
227c265
< void activateThread(unsigned int tid);
---
> void activateThread(unsigned tid);
228a267,269
> /** Remove Thread from Active Threads List */
> void deactivateThread(unsigned tid);
>
255c296
< void deallocateContext(int tid);
---
> void deallocateContext(int tid, int delay = 1);
271,277d311
< /** Serialize state. */
< virtual void serialize(std::ostream &os);
<
< /** Unserialize from a checkpoint. */
< virtual void unserialize(Checkpoint *cp, const std::string &section);
<
< public:
285,287c319,320
< /** Starts draining the CPU's pipeline of all instructions in
< * order to stop all memory accesses. */
< virtual bool drain(Event *drain_event);
---
> /** Switches out this CPU. */
> void switchOut();
289,291d321
< /** Resumes execution after a drain. */
< virtual void resume();
<
293c323
< void signalDrained();
---
> void signalSwitched();
295,297d324
< /** Switches out this CPU. */
< virtual void switchOut();
<
299c326
< virtual void takeOverFrom(BaseCPU *oldCPU);
---
> void takeOverFrom(BaseCPU *oldCPU);
572,573c599,600
< /** Event to call process() on once draining has completed. */
< Event *drainEvent;
---
> /** Counter of how many stages have completed switching out. */
> int switchCount;
575,577d601
< /** Counter of how many stages have completed draining. */
< int drainCount;
<