Major changes to how SimObjects are created and initialized. Almost all
[gem5.git] / src / sim / system.hh
index 059dc92dc7587f8314908e5ea253b1b8cdba6231..197d9027b01ed8b8c15397bbdb2d6b83e4a32146 100644 (file)
 #include "base/loader/symtab.hh"
 #include "base/misc.hh"
 #include "base/statistics.hh"
+#include "config/full_system.hh"
 #include "cpu/pc_event.hh"
+#include "enums/MemoryMode.hh"
 #include "mem/port.hh"
+#include "params/System.hh"
 #include "sim/sim_object.hh"
 #if FULL_SYSTEM
 #include "kern/system_events.hh"
@@ -54,13 +57,32 @@ class PhysicalMemory;
 
 #if FULL_SYSTEM
 class Platform;
-class GDBListener;
-class RemoteGDB;
 #endif
+class GDBListener;
+namespace TheISA
+{
+    class RemoteGDB;
+}
 
 class System : public SimObject
 {
   public:
+
+    static const char *MemoryModeStrings[3];
+
+    Enums::MemoryMode
+    getMemoryMode()
+    {
+        assert(memoryMode);
+        return memoryMode;
+    }
+
+    /** Change the memory mode of the system. This should only be called by the
+     * python!!
+     * @param mode Mode to change to (atomic/timing)
+     */
+    void setMemoryMode(Enums::MemoryMode mode);
+
     PhysicalMemory *physmem;
     PCEventQueue pcEventQueue;
 
@@ -107,6 +129,7 @@ class System : public SimObject
 #endif // FULL_SYSTEM
 
   protected:
+    Enums::MemoryMode memoryMode;
 
 #if FULL_SYSTEM
     /**
@@ -121,7 +144,7 @@ class System : public SimObject
      * up in the specified symbol table.
      */
     template <class T>
-    T *System::addFuncEvent(SymbolTable *symtab, const char *lbl)
+    T *addFuncEvent(SymbolTable *symtab, const char *lbl)
     {
         Addr addr = 0; // initialize only to avoid compiler warning
 
@@ -135,34 +158,19 @@ class System : public SimObject
 
     /** Add a function-based event to kernel code. */
     template <class T>
-    T *System::addKernelFuncEvent(const char *lbl)
+    T *addKernelFuncEvent(const char *lbl)
     {
         return addFuncEvent<T>(kernelSymtab, lbl);
     }
 
 #endif
   public:
-#if FULL_SYSTEM
-    std::vector<RemoteGDB *> remoteGDB;
+    std::vector<TheISA::RemoteGDB *> remoteGDB;
     std::vector<GDBListener *> gdbListen;
-    virtual bool breakpoint() = 0;
-#endif // FULL_SYSTEM
+    bool breakpoint();
 
   public:
-    struct Params
-    {
-        std::string name;
-        PhysicalMemory *physmem;
-
-#if FULL_SYSTEM
-        Tick boot_cpu_frequency;
-        std::string boot_osflags;
-        uint64_t init_param;
-
-        std::string kernel_path;
-        std::string readfile;
-#endif
-    };
+    typedef SystemParams Params;
 
   protected:
     Params *_params;