summaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
Diffstat (limited to 'sim')
-rw-r--r--sim/main.cc10
-rw-r--r--sim/process.cc23
-rw-r--r--sim/process.hh2
3 files changed, 19 insertions, 16 deletions
diff --git a/sim/main.cc b/sim/main.cc
index 1748294af..c15d24453 100644
--- a/sim/main.cc
+++ b/sim/main.cc
@@ -31,6 +31,8 @@
///
#include <sys/types.h>
#include <sys/stat.h>
+#include <errno.h>
+#include <libgen.h>
#include <stdlib.h>
#include <signal.h>
@@ -107,7 +109,7 @@ abortHandler(int sigtype)
}
/// Simulator executable name
-const char *myProgName = "";
+char *myProgName = "";
/// Show brief help message.
void
@@ -400,12 +402,6 @@ main(int argc, char **argv)
// Reset to put the stats in a consistent state.
Stats::reset();
- // Nothing to simulate if we don't have at least one CPU somewhere.
- if (BaseCPU::numSimulatedCPUs() == 0) {
- cerr << "Fatal: no CPUs to simulate." << endl;
- exit(1);
- }
-
warn("Entering event queue. Starting simulation...\n");
SimStartup();
while (!mainEventQueue.empty()) {
diff --git a/sim/process.cc b/sim/process.cc
index c725d3b1c..4d860c51d 100644
--- a/sim/process.cc
+++ b/sim/process.cc
@@ -88,8 +88,6 @@ Process::Process(const string &name,
fd_map[i] = -1;
}
- num_syscalls = 0;
-
// other parameters will be initialized when the program is loaded
}
@@ -145,21 +143,28 @@ Process::registerExecContext(ExecContext *xc)
execContexts.push_back(xc);
if (myIndex == 0) {
- // first exec context for this process... initialize & enable
-
// copy process's initial regs struct
xc->regs = *init_regs;
-
- // mark this context as active.
- // activate with zero delay so that we start ticking right
- // away on cycle 0
- xc->activate(0);
}
// return CPU number to caller and increment available CPU count
return myIndex;
}
+void
+Process::startup()
+{
+ if (execContexts.empty())
+ return;
+
+ // first exec context for this process... initialize & enable
+ ExecContext *xc = execContexts[0];
+
+ // mark this context as active.
+ // activate with zero delay so that we start ticking right
+ // away on cycle 0
+ xc->activate(0);
+}
void
Process::replaceExecContext(ExecContext *xc, int xcIndex)
diff --git a/sim/process.hh b/sim/process.hh
index bb4829875..817ab656c 100644
--- a/sim/process.hh
+++ b/sim/process.hh
@@ -108,6 +108,8 @@ class Process : public SimObject
int stdout_fd,
int stderr_fd);
+ // post initialization startup
+ virtual void startup();
protected:
FunctionalMemory *memory;