base.cc (9384:877293183bdf) base.cc (9430:a113f27b68bd)
1/*
2 * Copyright (c) 2011-2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 105 unchanged lines hidden (view full) ---

114 return "CPU Progress";
115}
116
117BaseCPU::BaseCPU(Params *p, bool is_checker)
118 : MemObject(p), instCnt(0), _cpuId(p->cpu_id),
119 _instMasterId(p->system->getMasterId(name() + ".inst")),
120 _dataMasterId(p->system->getMasterId(name() + ".data")),
121 _taskId(ContextSwitchTaskId::Unknown), _pid(Request::invldPid),
1/*
2 * Copyright (c) 2011-2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 105 unchanged lines hidden (view full) ---

114 return "CPU Progress";
115}
116
117BaseCPU::BaseCPU(Params *p, bool is_checker)
118 : MemObject(p), instCnt(0), _cpuId(p->cpu_id),
119 _instMasterId(p->system->getMasterId(name() + ".inst")),
120 _dataMasterId(p->system->getMasterId(name() + ".data")),
121 _taskId(ContextSwitchTaskId::Unknown), _pid(Request::invldPid),
122 _switchedOut(p->defer_registration),
122 interrupts(p->interrupts), profileEvent(NULL),
123 numThreads(p->numThreads), system(p->system)
124{
125 // if Python did not provide a valid ID, do it here
126 if (_cpuId == -1 ) {
127 _cpuId = cpuList.size();
128 }
129

--- 221 unchanged lines hidden (view full) ---

351 return tid;
352 }
353 return 0;
354}
355
356void
357BaseCPU::switchOut()
358{
123 interrupts(p->interrupts), profileEvent(NULL),
124 numThreads(p->numThreads), system(p->system)
125{
126 // if Python did not provide a valid ID, do it here
127 if (_cpuId == -1 ) {
128 _cpuId = cpuList.size();
129 }
130

--- 221 unchanged lines hidden (view full) ---

352 return tid;
353 }
354 return 0;
355}
356
357void
358BaseCPU::switchOut()
359{
360 assert(!_switchedOut);
361 _switchedOut = true;
359 if (profileEvent && profileEvent->scheduled())
360 deschedule(profileEvent);
361}
362
363void
364BaseCPU::takeOverFrom(BaseCPU *oldCPU)
365{
366 assert(threadContexts.size() == oldCPU->threadContexts.size());
367 assert(_cpuId == oldCPU->cpuId());
362 if (profileEvent && profileEvent->scheduled())
363 deschedule(profileEvent);
364}
365
366void
367BaseCPU::takeOverFrom(BaseCPU *oldCPU)
368{
369 assert(threadContexts.size() == oldCPU->threadContexts.size());
370 assert(_cpuId == oldCPU->cpuId());
371 assert(_switchedOut);
372 assert(oldCPU != this);
368 _pid = oldCPU->getPid();
369 _taskId = oldCPU->taskId();
373 _pid = oldCPU->getPid();
374 _taskId = oldCPU->taskId();
375 _switchedOut = false;
370
371 ThreadID size = threadContexts.size();
372 for (ThreadID i = 0; i < size; ++i) {
373 ThreadContext *newTC = threadContexts[i];
374 ThreadContext *oldTC = oldCPU->threadContexts[i];
375
376 newTC->takeOverFrom(oldTC);
377

--- 187 unchanged lines hidden ---
376
377 ThreadID size = threadContexts.size();
378 for (ThreadID i = 0; i < size; ++i) {
379 ThreadContext *newTC = threadContexts[i];
380 ThreadContext *oldTC = oldCPU->threadContexts[i];
381
382 newTC->takeOverFrom(oldTC);
383

--- 187 unchanged lines hidden ---