diff -r f654fee8faf7 -r e36d1a8d6ffc src/sim/pseudo_inst.cc --- a/src/sim/pseudo_inst.cc Thu Oct 17 11:53:07 2013 -0500 +++ b/src/sim/pseudo_inst.cc Thu Oct 17 11:53:59 2013 -0500 @@ -345,7 +345,7 @@ { DPRINTF(PseudoInst, "PseudoInst::m5exit(%i)\n", delay); Tick when = curTick() + delay * SimClock::Int::ns; - exitSimLoop("m5_exit instruction encountered", 0, when); + exitSimLoop("m5_exit instruction encountered", 0, when, 0, true); } void @@ -353,7 +353,7 @@ { DPRINTF(PseudoInst, "PseudoInst::m5fail(%i, %i)\n", delay, code); Tick when = curTick() + delay * SimClock::Int::ns; - exitSimLoop("m5_fail instruction encountered", code, when); + exitSimLoop("m5_fail instruction encountered", code, when, 0, true); } void diff -r f654fee8faf7 -r e36d1a8d6ffc src/sim/sim_events.hh --- a/src/sim/sim_events.hh Thu Oct 17 11:53:07 2013 -0500 +++ b/src/sim/sim_events.hh Thu Oct 17 11:53:59 2013 -0500 @@ -1,4 +1,16 @@ /* + * Copyright (c) 2013 ARM Limited + * All rights reserved + * + * The license below extends only to copyright in the software and shall + * not be construed as granting a license to any other intellectual + * property including but not limited to intellectual property relating + * to a hardware implementation of the functionality of the software + * licensed hereunder. You may use the software subject to the license + * terms below provided that you ensure that this notice is replicated + * unmodified and in its entirety in all distributions of the software, + * modified or unmodified, in source code or in binary form. + * * Copyright (c) 2002-2005 The Regents of The University of Michigan * All rights reserved. * @@ -32,6 +44,7 @@ #define __SIM_SIM_EVENTS_HH__ #include "sim/eventq.hh" +#include "sim/serialize.hh" // // Event to terminate simulation at a particular cycle/instruction @@ -45,7 +58,10 @@ Tick repeat; public: - SimLoopExitEvent(const std::string &_cause, int c, Tick repeat = 0); + // non-scheduling version for createForUnserialize() + SimLoopExitEvent(); + SimLoopExitEvent(const std::string &_cause, int c, Tick repeat = 0, + bool serialize = false); std::string getCause() { return cause; } int getCode() { return code; } @@ -53,6 +69,11 @@ void process(); // process event virtual const char *description() const; + + virtual void serialize(std::ostream &os); + virtual void unserialize(Checkpoint *cp, const std::string §ion); + static Serializable *createForUnserialize(Checkpoint *cp, + const std::string §ion); }; class CountedDrainEvent : public Event diff -r f654fee8faf7 -r e36d1a8d6ffc src/sim/sim_events.cc --- a/src/sim/sim_events.cc Thu Oct 17 11:53:07 2013 -0500 +++ b/src/sim/sim_events.cc Thu Oct 17 11:53:59 2013 -0500 @@ -1,4 +1,16 @@ /* + * Copyright (c) 2013 ARM Limited + * All rights reserved + * + * The license below extends only to copyright in the software and shall + * not be construed as granting a license to any other intellectual + * property including but not limited to intellectual property relating + * to a hardware implementation of the functionality of the software + * licensed hereunder. You may use the software subject to the license + * terms below provided that you ensure that this notice is replicated + * unmodified and in its entirety in all distributions of the software, + * modified or unmodified, in source code or in binary form. + * * Copyright (c) 2002-2005 The Regents of The University of Michigan * All rights reserved. * @@ -39,8 +51,16 @@ using namespace std; -SimLoopExitEvent::SimLoopExitEvent(const std::string &_cause, int c, Tick r) - : Event(Sim_Exit_Pri, IsExitEvent), cause(_cause), code(c), repeat(r) +SimLoopExitEvent::SimLoopExitEvent() + : Event(Sim_Exit_Pri, IsExitEvent | AutoSerialize), + cause(""), code(0), repeat(0) +{ +} + +SimLoopExitEvent::SimLoopExitEvent(const std::string &_cause, int c, Tick r, + bool serialize) + : Event(Sim_Exit_Pri, IsExitEvent | (serialize ? AutoSerialize : 0)), + cause(_cause), code(c), repeat(r) { } @@ -77,9 +97,39 @@ } void -exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat) +SimLoopExitEvent::serialize(ostream &os) { - Event *event = new SimLoopExitEvent(message, exit_code, repeat); + paramOut(os, "type", string("SimLoopExitEvent")); + Event::serialize(os); + + paramOut(os, "cause", cause); + SERIALIZE_SCALAR(code); + SERIALIZE_SCALAR(repeat); +} + +void +SimLoopExitEvent::unserialize(Checkpoint *cp, const string §ion) +{ + Event::unserialize(cp, section); + + paramIn(cp, section, "cause", cause); + UNSERIALIZE_SCALAR(code); + UNSERIALIZE_SCALAR(repeat); +} + +Serializable * +SimLoopExitEvent::createForUnserialize(Checkpoint *cp, const string §ion) +{ + return new SimLoopExitEvent(); +} + +REGISTER_SERIALIZEABLE("SimLoopExitEvent", SimLoopExitEvent) + +void +exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat, + bool serialize) +{ + Event *event = new SimLoopExitEvent(message, exit_code, repeat, serialize); mainEventQueue.schedule(event, when); } diff -r f654fee8faf7 -r e36d1a8d6ffc src/sim/sim_exit.hh --- a/src/sim/sim_exit.hh Thu Oct 17 11:53:07 2013 -0500 +++ b/src/sim/sim_exit.hh Thu Oct 17 11:53:59 2013 -0500 @@ -51,6 +51,7 @@ /// and exit_code parameters are saved in the SimLoopExitEvent to /// indicate why the exit occurred. void exitSimLoop(const std::string &message, int exit_code = 0, - Tick when = curTick(), Tick repeat = 0); + Tick when = curTick(), Tick repeat = 0, + bool serialize = false); #endif // __SIM_EXIT_HH__