summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
authorAli Saidi <Ali.Saidi@ARM.com>2012-03-09 09:59:26 -0500
committerAli Saidi <Ali.Saidi@ARM.com>2012-03-09 09:59:26 -0500
commit3ce2d0fad04201b168dd9847a5120c80408f6498 (patch)
tree76c86f659e55295c3b9d85b3d424bf8fa3b35765 /src/sim
parentec1ef24895de75e8408398492ee8190866650bb5 (diff)
downloadgem5-3ce2d0fad04201b168dd9847a5120c80408f6498.tar.xz
System: Move code in initState() back into constructor whenever possible.
The change to port proxies recently moved code out of the constructor into initState(). This is needed for code that loads data into memory, however for code that setups symbol tables, kernel based events, etc this is the wrong thing to do as that code is only called when a checkpoint isn't being restored from.
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/system.cc71
1 files changed, 39 insertions, 32 deletions
diff --git a/src/sim/system.cc b/src/sim/system.cc
index 36d4447ff..4601d2d52 100644
--- a/src/sim/system.cc
+++ b/src/sim/system.cc
@@ -117,6 +117,44 @@ System::System(Params *p)
tmp_id = getMasterId("interrupt");
assert(tmp_id == Request::intMasterId);
+ if (FullSystem) {
+ if (params()->kernel == "") {
+ inform("No kernel set for full system simulation. "
+ "Assuming you know what you're doing if not SPARC ISA\n");
+ } else {
+ // Get the 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);
+
+ // 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");
+
+ 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->loadLocalSymbols(debugSymbolTable))
+ fatal("could not load kernel local symbols\n");
+
+ // Loading only needs to happen once and after memory system is
+ // connected so it will happen in initState()
+ }
+ }
+
+ // increment the number of running systms
+ numSystemsRunning++;
+
}
System::~System()
@@ -232,38 +270,10 @@ System::initState()
/**
* 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 (params()->kernel != "") {
// Load program sections into memory
kernel->loadSections(physProxy, loadAddrMask);
- // 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");
-
- 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->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);
@@ -271,9 +281,6 @@ System::initState()
}
}
- // increment the number of running systms
- numSystemsRunning++;
-
activeCpus.clear();
if (!FullSystem)