1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 80 unchanged lines hidden (view full) --- 89const char * 90CPUProgressEvent::description() const 91{ 92 return "CPU Progress"; 93} 94 95#if FULL_SYSTEM 96BaseCPU::BaseCPU(Params *p) |
97 : MemObject(p), clock(p->clock), instCnt(0), _cpuId(p->cpu_id), 98 interrupts(p->interrupts), |
99 number_of_threads(p->numThreads), system(p->system), 100 phase(p->phase) 101#else 102BaseCPU::BaseCPU(Params *p) |
103 : MemObject(p), clock(p->clock), _cpuId(p->cpu_id), |
104 number_of_threads(p->numThreads), system(p->system), 105 phase(p->phase) 106#endif 107{ 108// currentTick = curTick; 109 |
110 // if Python did not provide a valid ID, do it here 111 if (_cpuId == -1 ) { 112 _cpuId = cpuList.size(); 113 } 114 |
115 // add self to global list of CPUs 116 cpuList.push_back(this); 117 |
118 DPRINTF(SyscallVerbose, "Constructing CPU with id %d\n", _cpuId); 119 |
120 if (number_of_threads > maxThreadsPerCPU) 121 maxThreadsPerCPU = number_of_threads; 122 123 // allocate per-thread instruction-based event queues 124 comInstEventQueue = new EventQueue *[number_of_threads]; 125 for (int i = 0; i < number_of_threads; ++i) 126 comInstEventQueue[i] = new EventQueue("instruction-based event queue"); 127 --- 153 unchanged lines hidden (view full) --- 281 282void 283BaseCPU::registerThreadContexts() 284{ 285 for (int i = 0; i < threadContexts.size(); ++i) { 286 ThreadContext *tc = threadContexts[i]; 287 288#if FULL_SYSTEM |
289 system->registerThreadContext(tc); |
290#else |
291 tc->getProcessPtr()->registerThreadContext(tc); |
292#endif 293 } 294} 295 296 297int 298BaseCPU::findContext(ThreadContext *tc) 299{ --- 14 unchanged lines hidden (view full) --- 314#endif 315} 316 317void 318BaseCPU::takeOverFrom(BaseCPU *oldCPU, Port *ic, Port *dc) 319{ 320 assert(threadContexts.size() == oldCPU->threadContexts.size()); 321 |
322 _cpuId = oldCPU->cpuId(); 323 |
324 for (int i = 0; i < threadContexts.size(); ++i) { 325 ThreadContext *newTC = threadContexts[i]; 326 ThreadContext *oldTC = oldCPU->threadContexts[i]; 327 328 newTC->takeOverFrom(oldTC); 329 330 CpuEvent::replaceThreadContext(oldTC, newTC); 331 |
332 assert(newTC->cpuId() == oldTC->cpuId()); |
333#if FULL_SYSTEM |
334 system->replaceThreadContext(newTC, newTC->cpuId()); |
335#else 336 assert(newTC->getProcessPtr() == oldTC->getProcessPtr()); |
337 newTC->getProcessPtr()->replaceThreadContext(newTC, newTC->cpuId()); |
338#endif 339 340 if (DTRACE(Context)) 341 ThreadContext::compare(oldTC, newTC); 342 } 343 344#if FULL_SYSTEM 345 interrupts = oldCPU->interrupts; --- 101 unchanged lines hidden --- |