Copy implementations
[gem5.git] / arch / alpha / pseudo_inst.cc
index 1f24a07f58603c4def1bb4d4db53e4372d002626..7f8c6b17ccf4542223ac70aa3f3cd6aa7182a655 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <string>
+
 #include "arch/alpha/pseudo_inst.hh"
 #include "cpu/exec_context.hh"
+#include "sim/annotation.hh"
+#include "sim/param.hh"
 #include "sim/serialize.hh"
 #include "sim/sim_exit.hh"
 #include "sim/sim_stats.hh"
 
+using namespace std;
 using namespace Statistics;
 
 namespace AlphaPseudo
 {
+    bool doStatisticsInsts;
+    bool doCheckpointInsts;
+    bool doQuiesce;
+
+    void
+    quiesce(ExecContext *xc)
+    {
+        if (!doQuiesce)
+            return;
+
+        Annotate::QUIESCE(xc);
+        xc->suspend();
+        xc->kernelStats.quiesce();
+    }
+
     void
     m5exit_old(ExecContext *xc)
     {
@@ -53,6 +73,9 @@ namespace AlphaPseudo
     void
     resetstats(ExecContext *xc)
     {
+        if (!doStatisticsInsts)
+            return;
+
         Tick delay = xc->regs.intRegFile[16];
         Tick period = xc->regs.intRegFile[17];
 
@@ -65,6 +88,9 @@ namespace AlphaPseudo
     void
     dumpstats(ExecContext *xc)
     {
+        if (!doStatisticsInsts)
+            return;
+
         Tick delay = xc->regs.intRegFile[16];
         Tick period = xc->regs.intRegFile[17];
 
@@ -77,6 +103,9 @@ namespace AlphaPseudo
     void
     dumpresetstats(ExecContext *xc)
     {
+        if (!doStatisticsInsts)
+            return;
+
         Tick delay = xc->regs.intRegFile[16];
         Tick period = xc->regs.intRegFile[17];
 
@@ -89,13 +118,42 @@ namespace AlphaPseudo
     void
     m5checkpoint(ExecContext *xc)
     {
+        if (!doCheckpointInsts)
+            return;
+
         Tick delay = xc->regs.intRegFile[16];
         Tick period = xc->regs.intRegFile[17];
 
         Tick when = curTick + NS2Ticks(delay);
         Tick repeat = NS2Ticks(period);
 
-        SetupCheckpoint(when, repeat);
+        Checkpoint::setup(when, repeat);
     }
 
+    class Context : public ParamContext
+    {
+      public:
+        Context(const string &section) : ParamContext(section) {}
+        void checkParams();
+    };
+
+    Context context("PseudoInsts");
+
+    Param<bool> __quiesce(&context, "quiesce",
+                          "enable quiesce instructions",
+                          true);
+    Param<bool> __statistics(&context, "statistics",
+                             "enable statistics pseudo instructions",
+                             true);
+    Param<bool> __checkpoint(&context, "checkpoint",
+                             "enable checkpoint pseudo instructions",
+                             true);
+
+    void
+    Context::checkParams()
+    {
+        doQuiesce = __quiesce;
+        doStatisticsInsts = __statistics;
+        doCheckpointInsts = __checkpoint;
+    }
 }