diff options
Diffstat (limited to 'src/cpu')
-rw-r--r-- | src/cpu/base.cc | 12 | ||||
-rw-r--r-- | src/cpu/base.hh | 6 | ||||
-rw-r--r-- | src/cpu/cpuevent.hh | 1 |
3 files changed, 19 insertions, 0 deletions
diff --git a/src/cpu/base.cc b/src/cpu/base.cc index deb4e02c4..8440d2320 100644 --- a/src/cpu/base.cc +++ b/src/cpu/base.cc @@ -298,6 +298,16 @@ BaseCPU::registerThreadContexts() } +int +BaseCPU::findContext(ThreadContext *tc) +{ + for (int i = 0; i < threadContexts.size(); ++i) { + if (tc == threadContexts[i]) + return i; + } + return 0; +} + void BaseCPU::switchOut() { @@ -389,12 +399,14 @@ BaseCPU::clear_interrupts() void BaseCPU::serialize(std::ostream &os) { + SERIALIZE_SCALAR(instCnt); interrupts.serialize(os); } void BaseCPU::unserialize(Checkpoint *cp, const std::string §ion) { + UNSERIALIZE_SCALAR(instCnt); interrupts.unserialize(cp, section); } diff --git a/src/cpu/base.hh b/src/cpu/base.hh index 3ae9c60b6..a1265b748 100644 --- a/src/cpu/base.hh +++ b/src/cpu/base.hh @@ -142,6 +142,12 @@ class BaseCPU : public MemObject /// Notify the CPU that the indicated context is now halted. virtual void haltContext(int thread_num) {} + /// Given a Thread Context pointer return the thread num + int findContext(ThreadContext *tc); + + /// Given a thread num get tho thread context for it + ThreadContext *getContext(int tn) { return threadContexts[tn]; } + public: struct Params { diff --git a/src/cpu/cpuevent.hh b/src/cpu/cpuevent.hh index c973621c0..5816c6ca1 100644 --- a/src/cpu/cpuevent.hh +++ b/src/cpu/cpuevent.hh @@ -71,6 +71,7 @@ class CpuEvent : public Event */ static void replaceThreadContext(ThreadContext *oldTc, ThreadContext *newTc); + ThreadContext* getTC() { return tc; } }; template <class T, void (T::* F)(ThreadContext *tc)> |