summaryrefslogtreecommitdiff
path: root/sim/prog.cc
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2003-10-23 19:09:18 -0700
committerSteve Reinhardt <stever@eecs.umich.edu>2003-10-23 19:09:18 -0700
commitcc9a838f4c5a5bf5e8951bdb351fc7d4b74661fb (patch)
tree1bae8b1b09fcc39d04631c84beaf51f830938372 /sim/prog.cc
parent320540829d62f9c5a5290a8c9bd991fda297a210 (diff)
parent6e2fc8ce766d1f9cb601b4a2a15d1ba294ce97a5 (diff)
downloadgem5-cc9a838f4c5a5bf5e8951bdb351fc7d4b74661fb.tar.xz
Merge stever@zizzer:/bk/m5 into isabel.reinhardt.house:/z/stever/bk/m5
--HG-- extra : convert_revision : b0f93bd35d767fd3a520a9fed70a71d40b0056db
Diffstat (limited to 'sim/prog.cc')
-rw-r--r--sim/prog.cc36
1 files changed, 23 insertions, 13 deletions
diff --git a/sim/prog.cc b/sim/prog.cc
index 275e1551b..599a0ca9a 100644
--- a/sim/prog.cc
+++ b/sim/prog.cc
@@ -85,8 +85,6 @@ Process::Process(const string &name,
fd_map[i] = -1;
}
- numCpus = 0;
-
num_syscalls = 0;
// other parameters will be initialized when the program is loaded
@@ -136,30 +134,42 @@ Process::openOutputFile(const string &filename)
}
-void
-Process::registerExecContext(ExecContext *ec)
+int
+Process::registerExecContext(ExecContext *xc)
{
- if (execContexts.empty()) {
+ // add to list
+ int myIndex = execContexts.size();
+ execContexts.push_back(xc);
+
+ if (myIndex == 0) {
// first exec context for this process... initialize & enable
// copy process's initial regs struct
- ec->regs = *init_regs;
+ xc->regs = *init_regs;
// mark this context as active
- ec->setStatus(ExecContext::Active);
+ xc->initStatus(ExecContext::Active);
}
else {
- ec->setStatus(ExecContext::Unallocated);
+ xc->initStatus(ExecContext::Unallocated);
}
- // add to list
- execContexts.push_back(ec);
-
- // increment available CPU count
- ++numCpus;
+ // return CPU number to caller and increment available CPU count
+ return myIndex;
}
+void
+Process::replaceExecContext(int xcIndex, ExecContext *xc)
+{
+ if (xcIndex >= execContexts.size()) {
+ panic("replaceExecContext: bad xcIndex, %d >= %d\n",
+ xcIndex, execContexts.size());
+ }
+
+ execContexts[xcIndex] = xc;
+}
+
// map simulator fd sim_fd to target fd tgt_fd
void
Process::dup_fd(int sim_fd, int tgt_fd)