diff options
-rw-r--r-- | src/sim/sim_events.cc | 14 | ||||
-rw-r--r-- | src/sim/sim_events.hh | 5 | ||||
-rw-r--r-- | src/sim/sim_exit.hh | 4 |
3 files changed, 19 insertions, 4 deletions
diff --git a/src/sim/sim_events.cc b/src/sim/sim_events.cc index 23da8fd8d..f9237e4ba 100644 --- a/src/sim/sim_events.cc +++ b/src/sim/sim_events.cc @@ -62,6 +62,13 @@ GlobalSimLoopExitEvent::GlobalSimLoopExitEvent(Tick when, { } +GlobalSimLoopExitEvent::GlobalSimLoopExitEvent(const std::string &_cause, + int c, Tick r) + : GlobalEvent(curTick(), Minimum_Pri, IsExitEvent), + cause(_cause), code(c), repeat(r) +{ +} + const char * GlobalSimLoopExitEvent::description() const { @@ -90,6 +97,13 @@ exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat, new GlobalSimLoopExitEvent(when + simQuantum, message, exit_code, repeat); } +void +exitSimLoopNow(const std::string &message, int exit_code, Tick repeat, + bool serialize) +{ + new GlobalSimLoopExitEvent(message, exit_code, repeat); +} + LocalSimLoopExitEvent::LocalSimLoopExitEvent(const std::string &_cause, int c, Tick r) : Event(Sim_Exit_Pri, IsExitEvent), diff --git a/src/sim/sim_events.hh b/src/sim/sim_events.hh index 6343071dc..8a4555212 100644 --- a/src/sim/sim_events.hh +++ b/src/sim/sim_events.hh @@ -60,10 +60,9 @@ class GlobalSimLoopExitEvent : public GlobalEvent Tick repeat; public: - // non-scheduling version for createForUnserialize() - GlobalSimLoopExitEvent(); GlobalSimLoopExitEvent(Tick when, const std::string &_cause, int c, Tick repeat = 0); + GlobalSimLoopExitEvent(const std::string &_cause, int c, Tick repeat = 0); const std::string getCause() const { return cause; } int getCode() const { return code; } @@ -94,8 +93,6 @@ class LocalSimLoopExitEvent : public Event void serialize(CheckpointOut &cp) const override; void unserialize(CheckpointIn &cp) override; - static Serializable *createForUnserialize(CheckpointIn &cp, - const std::string §ion); }; // diff --git a/src/sim/sim_exit.hh b/src/sim/sim_exit.hh index 55db55ff2..0a4634679 100644 --- a/src/sim/sim_exit.hh +++ b/src/sim/sim_exit.hh @@ -52,5 +52,9 @@ void registerExitCallback(Callback *); void exitSimLoop(const std::string &message, int exit_code = 0, Tick when = curTick(), Tick repeat = 0, bool serialize = false); +/// Schedule an event as above, but make it high priority so it runs before +/// any normal events which are schedule at the current time. +void exitSimLoopNow(const std::string &message, int exit_code = 0, + Tick repeat = 0, bool serialize = false); #endif // __SIM_EXIT_HH__ |