summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-08-26 15:53:31 -0700
committerGabe Black <gabeblack@google.com>2018-09-26 00:03:12 +0000
commitee30b44ad5d8913fb0869f75a1c78d87072e277a (patch)
tree166b3eb717ce433090b59726e296d002460eae02
parent9b6119a6a31f8597eebdc8bb469fd9f407ffa5e4 (diff)
downloadgem5-ee30b44ad5d8913fb0869f75a1c78d87072e277a.tar.xz
systemc: Handle sc_stop called from sc_main correctly.
When in sc_main, sc_is_running will return true but we're not going to run any gem5 events since we're currently in the sc_main Fiber. In that case, we need to do the sc_stop work inline. If we're actually running and not just paused, then we do still want to schedule the work of sc_stop to happen as its own event since that will happen before returning to sc_main, and actually will likely be the mechanism by which sc_main starts executing again. Change-Id: If9ffafc4f240af0f3d9c726b36a0950b5219dc00 Reviewed-on: https://gem5-review.googlesource.com/12269 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
-rw-r--r--src/systemc/core/sc_main.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/systemc/core/sc_main.cc b/src/systemc/core/sc_main.cc
index ea243bf61..2637cef0e 100644
--- a/src/systemc/core/sc_main.cc
+++ b/src/systemc/core/sc_main.cc
@@ -225,7 +225,7 @@ sc_stop()
if (::sc_gem5::Kernel::status() == SC_STOPPED)
return;
- if (sc_is_running()) {
+ if ((sc_get_status() & SC_RUNNING)) {
bool finish_delta = (_stop_mode == SC_STOP_FINISH_DELTA);
::sc_gem5::scheduler.scheduleStop(finish_delta);
} else {