cpu: Pass the address to check into the PCEventQueue service method.
authorGabe Black <gabeblack@google.com>
Thu, 10 Oct 2019 03:14:21 +0000 (20:14 -0700)
committerGabe Black <gabeblack@google.com>
Fri, 25 Oct 2019 22:42:31 +0000 (22:42 +0000)
This prevents having to access it from within the ThreadContext.

Change-Id: I34f5815a11201b8fc41871c18bdbbcd0f40305cf
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22102
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/cpu/checker/cpu_impl.hh
src/cpu/minor/execute.cc
src/cpu/o3/commit_impl.hh
src/cpu/pc_event.cc
src/cpu/pc_event.hh
src/cpu/simple/base.cc

index 86f022d41d751ae1d39265cf699c3a8639924b0e..95ea3f7bb71f5030a9edc2076f83e5e7856eaa10 100644 (file)
@@ -412,7 +412,7 @@ Checker<Impl>::verify(const DynInstPtr &completed_inst)
             int count = 0;
             do {
                 oldpc = thread->instAddr();
-                system->pcEventQueue.service(tc);
+                system->pcEventQueue.service(oldpc, tc);
                 count++;
             } while (oldpc != thread->instAddr());
             if (count > 1) {
index dc798661655d12b1ad8a3bfbc658025e65452aa5..a9d51b71792ccb5388436e8a9a9868e31f51a972 100644 (file)
@@ -841,7 +841,7 @@ Execute::tryPCEvents(ThreadID thread_id)
     Addr oldPC;
     do {
         oldPC = thread->instAddr();
-        cpu.system->pcEventQueue.service(thread);
+        cpu.system->pcEventQueue.service(oldPC, thread);
         num_pc_event_checks++;
     } while (oldPC != thread->instAddr());
 
index 2aa9d782457c529988fb09ee28294964099ca486..df439454b5fef50b3e5029421874947f2f93fd7c 100644 (file)
@@ -1112,7 +1112,8 @@ DefaultCommit<Impl>::commitInsts()
                            !thread[tid]->trapPending);
                     do {
                         oldpc = pc[tid].instAddr();
-                        cpu->system->pcEventQueue.service(thread[tid]->getTC());
+                        cpu->system->pcEventQueue.service(
+                                oldpc, thread[tid]->getTC());
                         count++;
                     } while (oldpc != pc[tid].instAddr());
                     if (count > 1) {
index 90c87334a60bf3b165d79dde4c5b09c6a6b50dda..725c051b7987b967a3cf32b75d3085c1c21aca92 100644 (file)
@@ -84,11 +84,10 @@ PCEventQueue::schedule(PCEvent *event)
 }
 
 bool
-PCEventQueue::doService(ThreadContext *tc)
+PCEventQueue::doService(Addr pc, ThreadContext *tc)
 {
-    // This will fail to break on Alpha PALcode addresses, but that is
-    // a rare use case.
-    Addr pc = tc->instAddr();
+    // Using the raw PC address will fail to break on Alpha PALcode addresses,
+    // but that is a rare use case.
     int serviced = 0;
     range_t range = equal_range(pc);
     for (iterator i = range.first; i != range.second; ++i) {
index 0654ca54e99d2e4dd8d7cbe154aab755ce58f50e..d5fd4ea708d5d91a58c7aa22c77426cc83b07afc 100644 (file)
@@ -105,7 +105,7 @@ class PCEventQueue : public PCEventScope
   protected:
     Map pcMap;
 
-    bool doService(ThreadContext *tc);
+    bool doService(Addr pc, ThreadContext *tc);
 
   public:
     PCEventQueue();
@@ -113,12 +113,12 @@ class PCEventQueue : public PCEventScope
 
     bool remove(PCEvent *event) override;
     bool schedule(PCEvent *event) override;
-    bool service(ThreadContext *tc)
+    bool service(Addr pc, ThreadContext *tc)
     {
         if (pcMap.empty())
             return false;
 
-        return doService(tc);
+        return doService(pc, tc);
     }
 
     range_t equal_range(Addr pc);
index 461f00fca3e870a80e03b44ab5df2d87bdd7d811..df3d981adc2467fcdd02bb530599a7995df54f11 100644 (file)
@@ -144,7 +144,7 @@ BaseSimpleCPU::checkPcEventQueue()
     Addr oldpc, pc = threadInfo[curThread]->thread->instAddr();
     do {
         oldpc = pc;
-        system->pcEventQueue.service(threadContexts[curThread]);
+        system->pcEventQueue.service(oldpc, threadContexts[curThread]);
         pc = threadInfo[curThread]->thread->instAddr();
     } while (oldpc != pc);
 }