Deleted Added
sdiff udiff text old ( 12127:4207df055b0d ) new ( 12276:22c220be30c5 )
full compact
1/*
2 * Copyright (c) 2011-2012,2016 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
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

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

131 _dataMasterId(p->system->getMasterId(name() + ".data")),
132 _taskId(ContextSwitchTaskId::Unknown), _pid(invldPid),
133 _switchedOut(p->switched_out), _cacheLineSize(p->system->cacheLineSize()),
134 interrupts(p->interrupts), profileEvent(NULL),
135 numThreads(p->numThreads), system(p->system),
136 functionTraceStream(nullptr), currentFunctionStart(0),
137 currentFunctionEnd(0), functionEntryTick(0),
138 addressMonitor(p->numThreads),
139 syscallRetryLatency(p->syscallRetryLatency)
140{
141 // if Python did not provide a valid ID, do it here
142 if (_cpuId == -1 ) {
143 _cpuId = cpuList.size();
144 }
145
146 // add self to global list of CPUs
147 cpuList.push_back(this);

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

356 if (!params()->switched_out && profileEvent)
357 schedule(profileEvent, curTick());
358 }
359
360 if (params()->progress_interval) {
361 new CPUProgressEvent(this, params()->progress_interval);
362 }
363
364 // Assumption CPU start to operate instantaneously without any latency
365 if (ClockedObject::pwrState() == Enums::PwrState::UNDEFINED)
366 ClockedObject::pwrState(Enums::PwrState::ON);
367
368}
369
370ProbePoints::PMUUPtr
371BaseCPU::pmuProbePoint(const char *name)

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

467 tc->setContextId(system->registerThreadContext(tc, _cpuId));
468 }
469
470 if (!FullSystem)
471 tc->getProcessPtr()->assignThreadContext(tc->contextId());
472 }
473}
474
475
476int
477BaseCPU::findContext(ThreadContext *tc)
478{
479 ThreadID size = threadContexts.size();
480 for (ThreadID tid = 0; tid < size; ++tid) {
481 if (tc == threadContexts[tid])
482 return tid;
483 }
484 return 0;
485}
486
487void
488BaseCPU::activateContext(ThreadID thread_num)
489{
490 // For any active thread running, update CPU power state to active (ON)
491 ClockedObject::pwrState(Enums::PwrState::ON);
492}
493
494void
495BaseCPU::suspendContext(ThreadID thread_num)
496{
497 // Check if all threads are suspended
498 for (auto t : threadContexts) {
499 if (t->status() != ThreadContext::Suspended) {
500 return;
501 }
502 }
503
504 // All CPU threads suspended, enter lower power state for the CPU
505 ClockedObject::pwrState(Enums::PwrState::CLK_GATED);
506}
507
508void
509BaseCPU::switchOut()
510{
511 assert(!_switchedOut);
512 _switchedOut = true;
513 if (profileEvent && profileEvent->scheduled())
514 deschedule(profileEvent);
515
516 // Flush all TLBs in the CPU to avoid having stale translations if
517 // it gets switched in later.
518 flushTLBs();
519}
520
521void
522BaseCPU::takeOverFrom(BaseCPU *oldCPU)
523{
524 assert(threadContexts.size() == oldCPU->threadContexts.size());
525 assert(_cpuId == oldCPU->cpuId());
526 assert(_switchedOut);
527 assert(oldCPU != this);
528 _pid = oldCPU->getPid();
529 _taskId = oldCPU->taskId();
530 _switchedOut = false;
531
532 ThreadID size = threadContexts.size();
533 for (ThreadID i = 0; i < size; ++i) {
534 ThreadContext *newTC = threadContexts[i];
535 ThreadContext *oldTC = oldCPU->threadContexts[i];
536
537 newTC->takeOverFrom(oldTC);

--- 250 unchanged lines hidden ---