summaryrefslogtreecommitdiff
path: root/cpu
diff options
context:
space:
mode:
authorLisa Hsu <hsul@eecs.umich.edu>2004-03-05 05:09:05 -0500
committerLisa Hsu <hsul@eecs.umich.edu>2004-03-05 05:09:05 -0500
commit4fa703f2ec733ccb8b5ffaa741db0b8510fbe188 (patch)
tree9e3d7ba5e6019181408a50123f7ef2fea55cc1db /cpu
parent2ef27db62c403e4b9e4fea0c2f894a1504309b2e (diff)
downloadgem5-4fa703f2ec733ccb8b5ffaa741db0b8510fbe188.tar.xz
serialization for binning. it is WAAAAAAAY past my bedtime.
cpu/exec_context.cc: sim/system.cc: sim/system.hh: serialization for binning --HG-- extra : convert_revision : f8417794a3a5ec7f2addc9c2da0f48e851899112
Diffstat (limited to 'cpu')
-rw-r--r--cpu/exec_context.cc48
1 files changed, 48 insertions, 0 deletions
diff --git a/cpu/exec_context.cc b/cpu/exec_context.cc
index b0ebb9622..20ab64bc4 100644
--- a/cpu/exec_context.cc
+++ b/cpu/exec_context.cc
@@ -104,6 +104,29 @@ ExecContext::serialize(ostream &os)
regs.serialize(os);
// thread_num and cpu_id are deterministic from the config
SERIALIZE_SCALAR(func_exe_inst);
+
+ bool ctx = false;
+ if (swCtx) {
+ ctx = true;
+ SERIALIZE_SCALAR(ctx);
+ SERIALIZE_SCALAR(swCtx->calls);
+ std::stack<fnCall *> *stack = &(swCtx->callStack);
+ fnCall *top;
+ int size = stack->size();
+ SERIALIZE_SCALAR(size);
+
+ for (int j=0; j<size; ++j) {
+ top = stack->top();
+ paramOut(os, csprintf("stackpos[%d]",j), top->name);
+ }
+ } else {
+ SERIALIZE_SCALAR(ctx);
+ }
+ if (system->bin) {
+ Statistics::MainBin *cur = Statistics::MainBin::curBin();
+ string bin_name = cur->name();
+ SERIALIZE_SCALAR(bin_name);
+ }
}
@@ -114,6 +137,31 @@ ExecContext::unserialize(Checkpoint *cp, const std::string &section)
regs.unserialize(cp, section);
// thread_num and cpu_id are deterministic from the config
UNSERIALIZE_SCALAR(func_exe_inst);
+
+ bool ctx;
+ UNSERIALIZE_SCALAR(ctx);
+ if (ctx) {
+ swCtx = new SWContext;
+ UNSERIALIZE_SCALAR(swCtx->calls);
+ int size;
+ UNSERIALIZE_SCALAR(size);
+ fnCall *call = new fnCall[size];
+ for (int i=0; i<size; ++i) {
+ paramIn(cp, section, csprintf("stackpos[%d]",i), call[i].name);
+ call[i].myBin = system->getBin(call[i].name);
+ }
+
+ for (int i=size-1; i>=0; --i) {
+ swCtx->callStack.push(&(call[i]));
+ }
+
+ }
+
+ if (system->bin) {
+ string bin_name;
+ UNSERIALIZE_SCALAR(bin_name);
+ system->getBin(bin_name)->activate();
+ }
}