Deleted Added
sdiff udiff text old ( 5704:98224505352a ) new ( 5712:199d31b47f7b )
full compact
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), interrupts(p->interrupts),
98 number_of_threads(p->numThreads), system(p->system),
99 phase(p->phase)
100#else
101BaseCPU::BaseCPU(Params *p)
102 : MemObject(p), clock(p->clock),
103 number_of_threads(p->numThreads), system(p->system),
104 phase(p->phase)
105#endif
106{
107// currentTick = curTick;
108
109 // add self to global list of CPUs
110 cpuList.push_back(this);
111
112 if (number_of_threads > maxThreadsPerCPU)
113 maxThreadsPerCPU = number_of_threads;
114
115 // allocate per-thread instruction-based event queues
116 comInstEventQueue = new EventQueue *[number_of_threads];
117 for (int i = 0; i < number_of_threads; ++i)
118 comInstEventQueue[i] = new EventQueue("instruction-based event queue");
119

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

273
274void
275BaseCPU::registerThreadContexts()
276{
277 for (int i = 0; i < threadContexts.size(); ++i) {
278 ThreadContext *tc = threadContexts[i];
279
280#if FULL_SYSTEM
281 int id = params()->cpu_id;
282 if (id != -1)
283 id += i;
284
285 tc->setCpuId(system->registerThreadContext(tc, id));
286#else
287 tc->setCpuId(tc->getProcessPtr()->registerThreadContext(tc));
288#endif
289 }
290}
291
292
293int
294BaseCPU::findContext(ThreadContext *tc)
295{

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

310#endif
311}
312
313void
314BaseCPU::takeOverFrom(BaseCPU *oldCPU, Port *ic, Port *dc)
315{
316 assert(threadContexts.size() == oldCPU->threadContexts.size());
317
318 for (int i = 0; i < threadContexts.size(); ++i) {
319 ThreadContext *newTC = threadContexts[i];
320 ThreadContext *oldTC = oldCPU->threadContexts[i];
321
322 newTC->takeOverFrom(oldTC);
323
324 CpuEvent::replaceThreadContext(oldTC, newTC);
325
326 assert(newTC->readCpuId() == oldTC->readCpuId());
327#if FULL_SYSTEM
328 system->replaceThreadContext(newTC, newTC->readCpuId());
329#else
330 assert(newTC->getProcessPtr() == oldTC->getProcessPtr());
331 newTC->getProcessPtr()->replaceThreadContext(newTC, newTC->readCpuId());
332#endif
333
334 if (DTRACE(Context))
335 ThreadContext::compare(oldTC, newTC);
336 }
337
338#if FULL_SYSTEM
339 interrupts = oldCPU->interrupts;

--- 101 unchanged lines hidden ---