From 46fbd76595faea874773a2ecbbdb36c3b56e697e Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sun, 12 Jan 2020 22:58:48 -0800 Subject: sim: Move findFreeContext to System. This method searches through the ThreadContexts stored in the system, and has no concrete connection to Process other than it happened to be used by a Process in the clone system call. By moving it, we can use its functionality in classes other than Process. Change-Id: Ic6899c335dc13841c6fe948ea3a4f8ad67e562bb Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24285 Reviewed-by: Giacomo Travaglini Reviewed-by: Jason Lowe-Power Reviewed-by: Brandon Potter Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/sim/system.hh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/sim/system.hh') diff --git a/src/sim/system.hh b/src/sim/system.hh index 6c63b327f..638e35249 100644 --- a/src/sim/system.hh +++ b/src/sim/system.hh @@ -188,6 +188,14 @@ class System : public SimObject, public PCEventScope unsigned int cacheLineSize() const { return _cacheLineSize; } std::vector threadContexts; + ThreadContext *findFreeContext(); + + ThreadContext * + getThreadContext(ContextID tid) const + { + return threadContexts[tid]; + } + const bool multiThread; using SimObject::schedule; @@ -195,11 +203,6 @@ class System : public SimObject, public PCEventScope bool schedule(PCEvent *event) override; bool remove(PCEvent *event) override; - ThreadContext *getThreadContext(ContextID tid) const - { - return threadContexts[tid]; - } - unsigned numContexts() const { return threadContexts.size(); } /** Return number of running (non-halted) thread contexts in -- cgit v1.2.3