Merge zizzer:/m5/Bitkeeper/m5
[gem5.git] / cpu / base_cpu.hh
index 745220d8557ef230531a9eeafff5ad6dc5d5031a..143fc9662e998c72c5715abff4563e0cce461151 100644 (file)
 
 #include <vector>
 
-#include "eventq.hh"
-#include "sim_object.hh"
+#include "sim/eventq.hh"
+#include "sim/sim_object.hh"
 
-#include "isa_traits.hh"       // for Addr
+#include "targetarch/isa_traits.hh"    // for Addr
 
 #ifdef FULL_SYSTEM
 class System;
@@ -47,7 +47,6 @@ class BaseCPU : public SimObject
 {
 #ifdef FULL_SYSTEM
   protected:
-    int number;
     Tick frequency;
     uint8_t interrupts[NumInterruptLevels];
     uint64_t intstatus;
@@ -71,45 +70,68 @@ class BaseCPU : public SimObject
 #endif
 
   protected:
-    std::vector<ExecContext *> contexts;
+    std::vector<ExecContext *> execContexts;
 
   public:
-    virtual void execCtxStatusChg() {}
+    virtual void execCtxStatusChg(int thread_num) {}
 
   public:
 
 #ifdef FULL_SYSTEM
     BaseCPU(const std::string &_name, int _number_of_threads,
             Counter max_insts_any_thread, Counter max_insts_all_threads,
-            System *_system,
-            int num, Tick freq);
+            Counter max_loads_any_thread, Counter max_loads_all_threads,
+            System *_system, Tick freq);
 #else
     BaseCPU(const std::string &_name, int _number_of_threads,
             Counter max_insts_any_thread = 0,
-            Counter max_insts_all_threads = 0);
+            Counter max_insts_all_threads = 0,
+            Counter max_loads_any_thread = 0,
+            Counter max_loads_all_threads = 0);
 #endif
 
     virtual ~BaseCPU() {}
 
     virtual void regStats();
 
-    /// Number of threads we're actually simulating (<= SMT_MAX_THREADS).
-    /// This is a constant for the duration of the simulation.
+    void registerExecContexts();
+
+    /// Prepare for another CPU to take over execution.  Called by
+    /// takeOverFrom() on its argument.
+    virtual void switchOut();
+
+    /// Take over execution from the given CPU.  Used for warm-up and
+    /// sampling.
+    virtual void takeOverFrom(BaseCPU *);
+
+    /**
+     *  Number of threads we're actually simulating (<= SMT_MAX_THREADS).
+     * This is a constant for the duration of the simulation.
+     */
     int number_of_threads;
 
-    /// Vector of per-thread instruction-based event queues.  Used for
-    /// scheduling events based on number of instructions committed by
-    /// a particular thread.
+    /**
+     * Vector of per-thread instruction-based event queues.  Used for
+     * scheduling events based on number of instructions committed by
+     * a particular thread.
+     */
     EventQueue **comInsnEventQueue;
 
+    /**
+     * Vector of per-thread load-based event queues.  Used for
+     * scheduling events based on number of loads committed by
+     *a particular thread.
+     */
+    EventQueue **comLoadEventQueue;
+
 #ifdef FULL_SYSTEM
     System *system;
 #endif
 
-    virtual bool filterThisInstructionPrefetch(int thread_number,
-        short asid, Addr prefetchTarget) const { return true; }
-
-    /// Return pointer to CPU's branch predictor (NULL if none).
+    /**
+     * Return pointer to CPU's branch predictor (NULL if none).
+     * @return Branch predictor pointer.
+     */
     virtual BranchPred *getBranchPred() { return NULL; };
 
   private: