sim: Make the System object a PCEventScope.
authorGabe Black <gabeblack@google.com>
Thu, 10 Oct 2019 02:22:37 +0000 (19:22 -0700)
committerGabe Black <gabeblack@google.com>
Fri, 25 Oct 2019 22:42:31 +0000 (22:42 +0000)
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>
src/arch/alpha/linux/system.cc
src/base/remote_gdb.cc
src/sim/system.cc
src/sim/system.hh

index ae9e5ef07d15f56626f63ab26c9f4dde3e84c91a..89d18f6f661db2dc6ff8e71546ab168c4622204f 100644 (file)
@@ -149,7 +149,7 @@ LinuxAlphaSystem::setupFuncEvents()
     // leads to non-intuitive behavior with --trace-start.
     Addr addr = 0;
     if (false && kernelSymtab->findAddress("alpha_switch_to", addr)) {
-        printThreadEvent = new PrintThreadInfo(&pcEventQueue, "threadinfo",
+        printThreadEvent = new PrintThreadInfo(this, "threadinfo",
                                                addr + sizeof(MachInst) * 6);
     } else {
         printThreadEvent = NULL;
index d0ccde56615e8fa582d588026095d480eb7eb381..3dde235f01dda3baa6b5d23a49e47922a9d01068 100644 (file)
@@ -717,7 +717,7 @@ BaseRemoteGDB::insertHardBreak(Addr addr, size_t len)
 
     HardBreakpoint *&bkpt = hardBreakMap[addr];
     if (bkpt == 0)
-        bkpt = new HardBreakpoint(this, &sys->pcEventQueue, addr);
+        bkpt = new HardBreakpoint(this, sys, addr);
 
     bkpt->refcount++;
 }
index 3868f57b83cc15a61c5506dcf761835ba13d225c..7b8ca87e3935bd9f216a4cef843fb2df6663ad03 100644 (file)
@@ -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()
 {
index 852bc21a2083d52901224ae64eeb89ad87e5351a..c2b841107da59424a2a2e1525ec2580572664494 100644 (file)
@@ -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;
         }