arch-arm: Instantiate a single HTM checkpoint at ISA::startup
authorTimothy Hayes <timothy.hayes@arm.com>
Wed, 23 Sep 2020 13:39:46 +0000 (14:39 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Tue, 29 Sep 2020 09:16:28 +0000 (09:16 +0000)
Change-Id: I48cc71dce607233f025387379507bcd485943dde
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35016
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/arch/arm/insts/tme64ruby.cc
src/arch/arm/isa.cc

index 99481ba436efcd3e2543cbfda07d70e675b0c8e4..f8d948197006b1a687d6223a2610e8825fc30d5f 100644 (file)
@@ -109,15 +109,16 @@ Tstart64::completeAcc(PacketPtr pkt, ExecContext *xc,
 
         // checkpointing occurs in the outer transaction only
         if (htm_depth == 1) {
-            auto new_cpt = new HTMCheckpoint();
+            BaseHTMCheckpointPtr& cpt = xc->tcBase()->getHtmCheckpointPtr();
 
-            new_cpt->save(tc);
-            new_cpt->destinationRegister(dest);
+            HTMCheckpoint *armcpt =
+                dynamic_cast<HTMCheckpoint*>(cpt.get());
+            assert(armcpt != nullptr);
 
-            ArmISA::globalClearExclusive(tc);
+            armcpt->save(tc);
+            armcpt->destinationRegister(dest);
 
-            xc->tcBase()->setHtmCheckpointPtr(
-                std::unique_ptr<BaseHTMCheckpoint>(new_cpt));
+            ArmISA::globalClearExclusive(tc);
         }
 
         xc->setIntRegOperand(this, 0, (Dest64) & mask(intWidth));
index 9ace2367f4b0da3978301d29a71326809bb6d5d8..4ad1125ebc6d9a4ac18afb39c6a0f5e05200ede8 100644 (file)
@@ -38,6 +38,7 @@
 #include "arch/arm/isa.hh"
 
 #include "arch/arm/faults.hh"
+#include "arch/arm/htm.hh"
 #include "arch/arm/interrupts.hh"
 #include "arch/arm/pmu.hh"
 #include "arch/arm/self_debug.hh"
@@ -439,9 +440,15 @@ ISA::startup()
 {
     BaseISA::startup();
 
-    if (tc)
+    if (tc) {
         setupThreadContext();
 
+        if (haveTME) {
+            std::unique_ptr<BaseHTMCheckpoint> cpt(new HTMCheckpoint());
+            tc->setHtmCheckpointPtr(std::move(cpt));
+        }
+    }
+
     afterStartup = true;
 }