pull from head before pushing linux tree
[gem5.git] / sim / system.hh
index bec1011ced94b0f237a7109ff5779cf4a06e22e2..baf82a5b5a858d38dce41288730c7617ce48ab16 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2002-2004 The Regents of The University of Michigan
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 #include <string>
 #include <vector>
 
-#include "sim/sim_object.hh"
-#include "cpu/pc_event.hh"
 #include "base/loader/symtab.hh"
+#include "base/statistics.hh"
+#include "cpu/pc_event.hh"
+#include "kern/system_events.hh"
+#include "sim/sim_object.hh"
+#include "sim/sw_context.hh"
 
 class MemoryController;
 class PhysicalMemory;
+class Platform;
 class RemoteGDB;
 class GDBListener;
 
@@ -45,27 +49,67 @@ class ExecContext;
 
 class System : public SimObject
 {
+    // lisa's binning stuff
+  private:
+    std::map<const std::string, Stats::MainBin *> fnBins;
+    std::map<const Addr, SWContext *> swCtxMap;
+
+  protected:
+    std::vector<FnEvent *> fnEvents;
+
+  public:
+    Stats::Scalar<> fnCalls;
+    Stats::MainBin *Kernel;
+    Stats::MainBin *User;
+
+    Stats::MainBin * getBin(const std::string &name);
+    bool findCaller(std::string, std::string) const;
+
+    SWContext *findContext(Addr pcb);
+    bool addContext(Addr pcb, SWContext *ctx) {
+        return (swCtxMap.insert(make_pair(pcb, ctx))).second;
+    }
+    void remContext(Addr pcb) {
+        swCtxMap.erase(pcb);
+        return;
+    }
+    void dumpState(ExecContext *xc) const;
+
+    virtual void serialize(std::ostream &os);
+    virtual void unserialize(Checkpoint *cp, const std::string &section);
+
+
+  private:
+    std::multimap<const std::string, std::string> callerMap;
+    void populateMap(std::string caller, std::string callee);
+//
+
   public:
+    const uint64_t init_param;
     MemoryController *memCtrl;
     PhysicalMemory *physmem;
+    Platform *platform;
+    bool bin;
+    std::vector<string> binned_fns;
 
     PCEventQueue pcEventQueue;
 
-    std::vector<ExecContext *> xcvec;
-    void registerExecContext(ExecContext *xc);
+    std::vector<ExecContext *> execContexts;
+
+    virtual int registerExecContext(ExecContext *xc);
+    virtual void replaceExecContext(int xcIndex, ExecContext *xc);
 
   public:
-    System(const std::string name, MemoryController *, PhysicalMemory *);
+    System(const std::string _name, const uint64_t _init_param,
+           MemoryController *, PhysicalMemory *, const bool,
+           const std::vector<string> &binned_fns);
     ~System();
 
-    virtual void init(ExecContext *xc) = 0;
-
     virtual Addr getKernelStart() const = 0;
     virtual Addr getKernelEnd() const = 0;
     virtual Addr getKernelEntry() const = 0;
     virtual bool breakpoint() = 0;
 
-
   public:
     ////////////////////////////////////////////
     //