diff options
author | Lisa Hsu <hsul@eecs.umich.edu> | 2004-03-11 18:52:29 -0500 |
---|---|---|
committer | Lisa Hsu <hsul@eecs.umich.edu> | 2004-03-11 18:52:29 -0500 |
commit | 3bc8cffc75c2e03a6a8fe5f4425940a16405f672 (patch) | |
tree | 1d44dba1a7dbd4aef6fad45753b7607928d3414a /cpu/exec_context.cc | |
parent | 1039028d408d5a374a67d8d3ecc640a0e6559fbb (diff) | |
parent | 2c60d7aa9e4b48f30ab8c48436ff2dfec8e390f2 (diff) | |
download | gem5-3bc8cffc75c2e03a6a8fe5f4425940a16405f672.tar.xz |
merge with m5 head
--HG--
extra : convert_revision : c90339248d1ee74df1c6b90a77ec9ea41f646311
Diffstat (limited to 'cpu/exec_context.cc')
-rw-r--r-- | cpu/exec_context.cc | 63 |
1 files changed, 59 insertions, 4 deletions
diff --git a/cpu/exec_context.cc b/cpu/exec_context.cc index 6a5f463cd..eedd8b8a8 100644 --- a/cpu/exec_context.cc +++ b/cpu/exec_context.cc @@ -48,10 +48,7 @@ ExecContext::ExecContext(BaseCPU *_cpu, int _thread_num, System *_sys, kernelStats(this, _cpu), cpu(_cpu), thread_num(_thread_num), cpu_id(-1), mem(_mem), itb(_itb), dtb(_dtb), system(_sys), memCtrl(_sys->memCtrl), physmem(_sys->physmem), -#ifdef FS_MEASURE - swCtx(NULL), -#endif - func_exe_inst(0), storeCondFailures(0) + swCtx(NULL), func_exe_inst(0), storeCondFailures(0) { memset(®s, 0, sizeof(RegFile)); } @@ -107,6 +104,33 @@ ExecContext::serialize(ostream &os) regs.serialize(os); // thread_num and cpu_id are deterministic from the config SERIALIZE_SCALAR(func_exe_inst); + +#ifdef FULL_SYSTEM + 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); + delete top; + stack->pop(); + } + } else { + SERIALIZE_SCALAR(ctx); + } + if (system->bin) { + Statistics::MainBin *cur = Statistics::MainBin::curBin(); + string bin_name = cur->name(); + SERIALIZE_SCALAR(bin_name); + } +#endif //FULL_SYSTEM } @@ -117,6 +141,37 @@ ExecContext::unserialize(Checkpoint *cp, const std::string §ion) regs.unserialize(cp, section); // thread_num and cpu_id are deterministic from the config UNSERIALIZE_SCALAR(func_exe_inst); + +#ifdef FULL_SYSTEM + bool ctx; + UNSERIALIZE_SCALAR(ctx); + if (ctx) { + swCtx = new SWContext; + UNSERIALIZE_SCALAR(swCtx->calls); + int size; + UNSERIALIZE_SCALAR(size); + + vector<fnCall *> calls; + fnCall *call; + for (int i=0; i<size; ++i) { + call = new fnCall; + paramIn(cp, section, csprintf("stackpos[%d]",i), call->name); + call->myBin = system->getBin(call->name); + calls.push_back(call); + } + + for (int i=size-1; i>=0; --i) { + swCtx->callStack.push(calls[i]); + } + + } + + if (system->bin) { + string bin_name; + UNSERIALIZE_SCALAR(bin_name); + system->getBin(bin_name)->activate(); + } +#endif //FULL_SYSTEM } |