Merge zizzer:/bk/linux into zeep.eecs.umich.edu:/z/saidi/work/m5-linux
[gem5.git] / arch / alpha / pseudo_inst.cc
index 1f24a07f58603c4def1bb4d4db53e4372d002626..f4201ab09c94a3234134af8b1e3c198dcc9208b7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2003-2004 The Regents of The University of Michigan
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * 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/param.hh"
 #include "sim/serialize.hh"
 #include "sim/sim_exit.hh"
-#include "sim/sim_stats.hh"
+#include "sim/stat_control.hh"
+#include "sim/stats.hh"
 
-using namespace Statistics;
+using namespace std;
+using namespace Stats;
 
 namespace AlphaPseudo
 {
+    bool doStatisticsInsts;
+    bool doCheckpointInsts;
+    bool doQuiesce;
+
+    void
+    arm(ExecContext *xc)
+    {
+        xc->kernelStats.arm();
+    }
+
+    void
+    quiesce(ExecContext *xc)
+    {
+        if (!doQuiesce)
+            return;
+
+        xc->suspend();
+        xc->kernelStats.quiesce();
+    }
+
+    void
+    ivlb(ExecContext *xc)
+    {
+        xc->kernelStats.ivlb();
+    }
+
+    void
+    ivle(ExecContext *xc)
+    {
+    }
+
     void
     m5exit_old(ExecContext *xc)
     {
@@ -53,49 +89,90 @@ namespace AlphaPseudo
     void
     resetstats(ExecContext *xc)
     {
+        if (!doStatisticsInsts)
+            return;
+
         Tick delay = xc->regs.intRegFile[16];
         Tick period = xc->regs.intRegFile[17];
 
         Tick when = curTick + NS2Ticks(delay);
         Tick repeat = NS2Ticks(period);
 
+        using namespace Stats;
         SetupEvent(Reset, when, repeat);
     }
 
     void
     dumpstats(ExecContext *xc)
     {
+        if (!doStatisticsInsts)
+            return;
+
         Tick delay = xc->regs.intRegFile[16];
         Tick period = xc->regs.intRegFile[17];
 
         Tick when = curTick + NS2Ticks(delay);
         Tick repeat = NS2Ticks(period);
 
+        using namespace Stats;
         SetupEvent(Dump, when, repeat);
     }
 
     void
     dumpresetstats(ExecContext *xc)
     {
+        if (!doStatisticsInsts)
+            return;
+
         Tick delay = xc->regs.intRegFile[16];
         Tick period = xc->regs.intRegFile[17];
 
         Tick when = curTick + NS2Ticks(delay);
         Tick repeat = NS2Ticks(period);
 
+        using namespace Stats;
         SetupEvent(Dump|Reset, when, repeat);
     }
 
     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;
+    }
 }