changeset f95b2a679eb0 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=f95b2a679eb0
description:
        SE/FS: Make the system object more consistent between SE and FS.

diffstat:

 src/sim/System.py |   20 +++----
 src/sim/system.cc |  141 +++++++++++++++++++++++------------------------------
 src/sim/system.hh |   29 +++-------
 3 files changed, 80 insertions(+), 110 deletions(-)

diffs (truncated from 354 to 300 lines):

diff -r 314eb1e2fa94 -r f95b2a679eb0 src/sim/System.py
--- a/src/sim/System.py Sun Oct 30 00:33:02 2011 -0700
+++ b/src/sim/System.py Sun Oct 30 02:30:55 2011 -0700
@@ -62,14 +62,12 @@
     work_cpus_ckpt_count = Param.Counter(0,
         "create checkpoint when active cpu count value is reached")
 
-    if buildEnv['FULL_SYSTEM']:
-        abstract = True
-        boot_cpu_frequency = Param.Frequency(Self.cpu[0].clock.frequency,
-                                             "boot processor frequency")
-        init_param = Param.UInt64(0, "numerical value to pass into simulator")
-        boot_osflags = Param.String("a", "boot flags to pass to the kernel")
-        kernel = Param.String("", "file that contains the kernel code")
-        readfile = Param.String("", "file to read startup script from")
-        symbolfile = Param.String("", "file to get the symbols from")
-        load_addr_mask = Param.UInt64(0xffffffffff,
-                "Address to mask loading binaries with");
+    boot_cpu_frequency = Param.Frequency(Self.cpu[0].clock.frequency,
+                                         "boot processor frequency")
+    init_param = Param.UInt64(0, "numerical value to pass into simulator")
+    boot_osflags = Param.String("a", "boot flags to pass to the kernel")
+    kernel = Param.String("", "file that contains the kernel code")
+    readfile = Param.String("", "file to read startup script from")
+    symbolfile = Param.String("", "file to get the symbols from")
+    load_addr_mask = Param.UInt64(0xffffffffff,
+            "Address to mask loading binaries with");
diff -r 314eb1e2fa94 -r f95b2a679eb0 src/sim/system.cc
--- a/src/sim/system.cc Sun Oct 30 00:33:02 2011 -0700
+++ b/src/sim/system.cc Sun Oct 30 02:30:55 2011 -0700
@@ -36,27 +36,23 @@
 #include "arch/isa_traits.hh"
 #include "arch/remote_gdb.hh"
 #include "arch/utility.hh"
+#include "arch/vtophys.hh"
 #include "base/loader/object_file.hh"
 #include "base/loader/symtab.hh"
 #include "base/trace.hh"
-#include "config/full_system.hh"
 #include "config/the_isa.hh"
 #include "cpu/thread_context.hh"
 #include "debug/Loader.hh"
+#include "kern/kernel_stats.hh"
 #include "mem/mem_object.hh"
 #include "mem/physical.hh"
+#include "mem/vport.hh"
+#include "params/System.hh"
 #include "sim/byteswap.hh"
 #include "sim/debug.hh"
+#include "sim/full_system.hh"
 #include "sim/system.hh"
 
-#if FULL_SYSTEM
-#include "arch/vtophys.hh"
-#include "kern/kernel_stats.hh"
-#include "mem/vport.hh"
-#else
-#include "params/System.hh"
-#endif
-
 using namespace std;
 using namespace TheISA;
 
@@ -66,10 +62,8 @@
 
 System::System(Params *p)
     : SimObject(p), physmem(p->physmem), _numContexts(0), pagePtr(0),
-#if FULL_SYSTEM
       init_param(p->init_param),
       loadAddrMask(p->load_addr_mask),
-#endif
       nextPID(0),
       memoryMode(p->mem_mode),
       workItemsBegin(0),
@@ -91,68 +85,68 @@
                                       p->memories[x]->size()));
     }
 
-#if FULL_SYSTEM
-    kernelSymtab = new SymbolTable;
-    if (!debugSymbolTable)
-        debugSymbolTable = new SymbolTable;
+    if (FullSystem) {
+        kernelSymtab = new SymbolTable;
+        if (!debugSymbolTable)
+            debugSymbolTable = new SymbolTable;
 
 
-    /**
-     * Get a functional port to memory
-     */
-    Port *mem_port;
-    functionalPort = new FunctionalPort(name() + "-fport");
-    mem_port = physmem->getPort("functional");
-    functionalPort->setPeer(mem_port);
-    mem_port->setPeer(functionalPort);
+        /**
+         * Get a functional port to memory
+         */
+        Port *mem_port;
+        functionalPort = new FunctionalPort(name() + "-fport");
+        mem_port = physmem->getPort("functional");
+        functionalPort->setPeer(mem_port);
+        mem_port->setPeer(functionalPort);
 
-    virtPort = new VirtualPort(name() + "-fport");
-    mem_port = physmem->getPort("functional");
-    virtPort->setPeer(mem_port);
-    mem_port->setPeer(virtPort);
+        virtPort = new VirtualPort(name() + "-fport");
+        mem_port = physmem->getPort("functional");
+        virtPort->setPeer(mem_port);
+        mem_port->setPeer(virtPort);
 
 
-    /**
-     * Load the kernel code into memory
-     */
-    if (params()->kernel == "") {
-        inform("No kernel set for full system simulation. Assuming you know 
what"
-                " you're doing...\n");
-    } else {
-        // Load kernel code
-        kernel = createObjectFile(params()->kernel);
-        inform("kernel located at: %s", params()->kernel);
+        /**
+         * Load the kernel code into memory
+         */
+        if (params()->kernel == "") {
+            inform("No kernel set for full system simulation. "
+                    "Assuming you know what you're doing...\n");
+        } else {
+            // Load kernel code
+            kernel = createObjectFile(params()->kernel);
+            inform("kernel located at: %s", params()->kernel);
 
-        if (kernel == NULL)
-            fatal("Could not load kernel file %s", params()->kernel);
+            if (kernel == NULL)
+                fatal("Could not load kernel file %s", params()->kernel);
 
-        // Load program sections into memory
-        kernel->loadSections(functionalPort, loadAddrMask);
+            // Load program sections into memory
+            kernel->loadSections(functionalPort, loadAddrMask);
 
-        // setup entry points
-        kernelStart = kernel->textBase();
-        kernelEnd = kernel->bssBase() + kernel->bssSize();
-        kernelEntry = kernel->entryPoint();
+            // setup entry points
+            kernelStart = kernel->textBase();
+            kernelEnd = kernel->bssBase() + kernel->bssSize();
+            kernelEntry = kernel->entryPoint();
 
-        // load symbols
-        if (!kernel->loadGlobalSymbols(kernelSymtab))
-            fatal("could not load kernel symbols\n");
+            // load symbols
+            if (!kernel->loadGlobalSymbols(kernelSymtab))
+                fatal("could not load kernel symbols\n");
 
-        if (!kernel->loadLocalSymbols(kernelSymtab))
-            fatal("could not load kernel local symbols\n");
+            if (!kernel->loadLocalSymbols(kernelSymtab))
+                fatal("could not load kernel local symbols\n");
 
-        if (!kernel->loadGlobalSymbols(debugSymbolTable))
-            fatal("could not load kernel symbols\n");
+            if (!kernel->loadGlobalSymbols(debugSymbolTable))
+                fatal("could not load kernel symbols\n");
 
-        if (!kernel->loadLocalSymbols(debugSymbolTable))
-            fatal("could not load kernel local symbols\n");
+            if (!kernel->loadLocalSymbols(debugSymbolTable))
+                fatal("could not load kernel local symbols\n");
 
-        DPRINTF(Loader, "Kernel start = %#x\n", kernelStart);
-        DPRINTF(Loader, "Kernel end   = %#x\n", kernelEnd);
-        DPRINTF(Loader, "Kernel entry = %#x\n", kernelEntry);
-        DPRINTF(Loader, "Kernel loaded...\n");
+            DPRINTF(Loader, "Kernel start = %#x\n", kernelStart);
+            DPRINTF(Loader, "Kernel end   = %#x\n", kernelEnd);
+            DPRINTF(Loader, "Kernel entry = %#x\n", kernelEntry);
+            DPRINTF(Loader, "Kernel loaded...\n");
+        }
     }
-#endif // FULL_SYSTEM
 
     // increment the number of running systms
     numSystemsRunning++;
@@ -162,13 +156,8 @@
 
 System::~System()
 {
-#if FULL_SYSTEM
     delete kernelSymtab;
     delete kernel;
-#else
-    panic("System::fixFuncEventAddr needs to be rewritten "
-          "to work with syscall emulation");
-#endif // FULL_SYSTEM}
 }
 
 void
@@ -251,11 +240,11 @@
 void
 System::initState()
 {
-#if FULL_SYSTEM
-    int i;
-    for (i = 0; i < threadContexts.size(); i++)
-        TheISA::startupCPU(threadContexts[i], i);
-#endif
+    if (FullSystem) {
+        int i;
+        for (i = 0; i < threadContexts.size(); i++)
+            TheISA::startupCPU(threadContexts[i], i);
+    }
 }
 
 void
@@ -314,9 +303,8 @@
 void
 System::serialize(ostream &os)
 {
-#if FULL_SYSTEM
-    kernelSymtab->serialize("kernel_symtab", os);
-#endif
+    if (FullSystem)
+        kernelSymtab->serialize("kernel_symtab", os);
     SERIALIZE_SCALAR(pagePtr);
     SERIALIZE_SCALAR(nextPID);
 }
@@ -325,9 +313,8 @@
 void
 System::unserialize(Checkpoint *cp, const string &section)
 {
-#if FULL_SYSTEM
-    kernelSymtab->unserialize("kernel_symtab", cp, section);
-#endif
+    if (FullSystem)
+        kernelSymtab->unserialize("kernel_symtab", cp, section);
     UNSERIALIZE_SCALAR(pagePtr);
     UNSERIALIZE_SCALAR(nextPID);
 }
@@ -352,12 +339,8 @@
 const char *System::MemoryModeStrings[3] = {"invalid", "atomic",
     "timing"};
 
-#if !FULL_SYSTEM
-
 System *
 SystemParams::create()
 {
     return new System(this);
 }
-
-#endif
diff -r 314eb1e2fa94 -r f95b2a679eb0 src/sim/system.hh
--- a/src/sim/system.hh Sun Oct 30 00:33:02 2011 -0700
+++ b/src/sim/system.hh Sun Oct 30 02:30:55 2011 -0700
@@ -44,26 +44,20 @@
 #include "config/full_system.hh"
 #include "cpu/pc_event.hh"
 #include "enums/MemoryMode.hh"
+#include "kern/system_events.hh"
 #include "mem/port.hh"
 #include "params/System.hh"
 #include "sim/sim_object.hh"
 
-#if FULL_SYSTEM
-#include "kern/system_events.hh"
-#endif
-
 class BaseCPU;
-class ThreadContext;
+class BaseRemoteGDB;
+class FunctionalPort;
+class GDBListener;
 class ObjectFile;
 class PhysicalMemory;
-
-#if FULL_SYSTEM
 class Platform;
-class FunctionalPort;
+class ThreadContext;
 class VirtualPort;
-#endif
-class GDBListener;
-class BaseRemoteGDB;
 
 class System : public SimObject
 {
@@ -115,7 +109,6 @@
 
     Addr pagePtr;
 
-#if FULL_SYSTEM
     uint64_t init_param;
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to