summaryrefslogtreecommitdiff
path: root/src/cpu/simple_thread.cc
diff options
context:
space:
mode:
authorAndreas Sandberg <Andreas.Sandberg@ARM.com>2013-01-07 13:05:46 -0500
committerAndreas Sandberg <Andreas.Sandberg@ARM.com>2013-01-07 13:05:46 -0500
commit52ff37caa3dc434baa0468f13ac609430f078982 (patch)
treec5d1ff3172fa4ba3069741d1110aa043bafa1b91 /src/cpu/simple_thread.cc
parentfca4fea769c09add919099e5ede694145c5c5f77 (diff)
downloadgem5-52ff37caa3dc434baa0468f13ac609430f078982.tar.xz
cpu: Fix broken thread context handover
The thread context handover code used to break when multiple handovers were performed during the same quiesce period. Previously, the thread contexts would assign the TC pointer in the old quiesce event to the new TC. This obviously broke in cases where multiple switches were performed within the same quiesce period, in which case the TC pointer in the quiesce event would point to an old CPU. The new implementation deschedules pending quiesce events in the old TC and schedules a new quiesce event in the new TC. The code has been refactored to remove most of the code duplication.
Diffstat (limited to 'src/cpu/simple_thread.cc')
-rw-r--r--src/cpu/simple_thread.cc44
1 files changed, 3 insertions, 41 deletions
diff --git a/src/cpu/simple_thread.cc b/src/cpu/simple_thread.cc
index 787680224..9cf8da7b4 100644
--- a/src/cpu/simple_thread.cc
+++ b/src/cpu/simple_thread.cc
@@ -107,49 +107,11 @@ SimpleThread::~SimpleThread()
void
SimpleThread::takeOverFrom(ThreadContext *oldContext)
{
- // some things should already be set up
- if (FullSystem)
- assert(system == oldContext->getSystemPtr());
- assert(process == oldContext->getProcessPtr());
-
- copyState(oldContext);
- if (FullSystem) {
- EndQuiesceEvent *quiesce = oldContext->getQuiesceEvent();
- if (quiesce) {
- // Point the quiesce event's TC at this TC so that it wakes up
- // the proper CPU.
- quiesce->tc = tc;
- }
- if (quiesceEvent) {
- quiesceEvent->tc = tc;
- }
-
- TheISA::Kernel::Statistics *stats = oldContext->getKernelStats();
- if (stats) {
- kernelStats = stats;
- }
- }
+ ::takeOverFrom(*tc, *oldContext);
+ kernelStats = oldContext->getKernelStats();
+ funcExeInst = oldContext->readFuncExeInst();
storeCondFailures = 0;
-
- oldContext->setStatus(ThreadContext::Halted);
-}
-
-void
-SimpleThread::copyTC(ThreadContext *context)
-{
- copyState(context);
-
- if (FullSystem) {
- EndQuiesceEvent *quiesce = context->getQuiesceEvent();
- if (quiesce) {
- quiesceEvent = quiesce;
- }
- TheISA::Kernel::Statistics *stats = context->getKernelStats();
- if (stats) {
- kernelStats = stats;
- }
- }
}
void