diff options
author | Gabe Black <gabeblack@google.com> | 2019-10-09 19:22:37 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2019-10-25 22:42:31 +0000 |
commit | 6f42417144fe1a2e3ca37a3b419a57fc825030e2 (patch) | |
tree | a857312aba66445734db17ad91bdba047d1d1ab9 /src/sim | |
parent | b6d822c5c04a0ea441c66fcf0a736c81f07d17b9 (diff) | |
download | gem5-6f42417144fe1a2e3ca37a3b419a57fc825030e2.tar.xz |
sim: Make the System object a PCEventScope.
This abstracts away the raw PCEventQueue managed by the System.
Change-Id: I04d773e6be90a891884a76841f15c3eecd5796ed
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22101
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/sim')
-rw-r--r-- | src/sim/system.cc | 14 | ||||
-rw-r--r-- | src/sim/system.hh | 15 |
2 files changed, 27 insertions, 2 deletions
diff --git a/src/sim/system.cc b/src/sim/system.cc index 3868f57b8..7b8ca87e3 100644 --- a/src/sim/system.cc +++ b/src/sim/system.cc @@ -292,6 +292,20 @@ System::registerThreadContext(ThreadContext *tc, ContextID assigned) return id; } +#if THE_ISA != NULL_ISA +bool +System::schedule(PCEvent *event) +{ + return pcEventQueue.schedule(event); +} + +bool +System::remove(PCEvent *event) +{ + return pcEventQueue.remove(event); +} +#endif + int System::numRunningContexts() { diff --git a/src/sim/system.hh b/src/sim/system.hh index 852bc21a2..c2b841107 100644 --- a/src/sim/system.hh +++ b/src/sim/system.hh @@ -74,7 +74,8 @@ */ #if THE_ISA != NULL_ISA #include "cpu/pc_event.hh" - +#else +class PCEvent; #endif class BaseRemoteGDB; @@ -83,6 +84,9 @@ class ObjectFile; class ThreadContext; class System : public SimObject +#if THE_ISA != NULL_ISA + , public PCEventScope +#endif { private: @@ -201,6 +205,13 @@ class System : public SimObject std::vector<ThreadContext *> threadContexts; const bool multiThread; + using SimObject::schedule; + +#if THE_ISA != NULL_ISA + bool schedule(PCEvent *event) override; + bool remove(PCEvent *event) override; +#endif + ThreadContext *getThreadContext(ContextID tid) const { return threadContexts[tid]; @@ -493,7 +504,7 @@ class System : public SimObject #if THE_ISA != NULL_ISA if (symtab->findAddress(lbl, addr)) { - T *ev = new T(&pcEventQueue, desc, fixFuncEventAddr(addr), + T *ev = new T(this, desc, fixFuncEventAddr(addr), std::forward<Args>(args)...); return ev; } |