diff options
Diffstat (limited to 'src/cpu/base.cc')
-rw-r--r-- | src/cpu/base.cc | 53 |
1 files changed, 19 insertions, 34 deletions
diff --git a/src/cpu/base.cc b/src/cpu/base.cc index 370be7ee1..d174995a9 100644 --- a/src/cpu/base.cc +++ b/src/cpu/base.cc @@ -59,6 +59,7 @@ #include "cpu/thread_context.hh" #include "debug/SyscallVerbose.hh" #include "params/BaseCPU.hh" +#include "sim/full_system.hh" #include "sim/process.hh" #include "sim/sim_events.hh" #include "sim/sim_exit.hh" @@ -112,18 +113,11 @@ CPUProgressEvent::description() const return "CPU Progress"; } -#if FULL_SYSTEM BaseCPU::BaseCPU(Params *p) : MemObject(p), clock(p->clock), instCnt(0), _cpuId(p->cpu_id), interrupts(p->interrupts), numThreads(p->numThreads), system(p->system), phase(p->phase) -#else -BaseCPU::BaseCPU(Params *p) - : MemObject(p), clock(p->clock), _cpuId(p->cpu_id), - numThreads(p->numThreads), system(p->system), - phase(p->phase) -#endif { // currentTick = curTick(); @@ -218,13 +212,13 @@ BaseCPU::BaseCPU(Params *p) schedule(event, p->function_trace_start); } } -#if FULL_SYSTEM interrupts->setCPU(this); - profileEvent = NULL; - if (params()->profile) - profileEvent = new ProfileEvent(this, params()->profile); -#endif + if (FullSystem) { + profileEvent = NULL; + if (params()->profile) + profileEvent = new ProfileEvent(this, params()->profile); + } tracer = params()->tracer; } @@ -248,10 +242,10 @@ BaseCPU::init() void BaseCPU::startup() { -#if FULL_SYSTEM - if (!params()->defer_registration && profileEvent) - schedule(profileEvent, curTick()); -#endif + if (FullSystem) { + if (!params()->defer_registration && profileEvent) + schedule(profileEvent, curTick()); + } if (params()->progress_interval) { Tick num_ticks = ticks(params()->progress_interval); @@ -290,9 +284,6 @@ BaseCPU::regStats() } } else if (size == 1) threadContexts[0]->regStats(name()); - -#if FULL_SYSTEM -#endif } Tick @@ -334,9 +325,9 @@ BaseCPU::registerThreadContexts() tc->setContextId(system->registerThreadContext(tc, _cpuId)); else tc->setContextId(system->registerThreadContext(tc)); -#if !FULL_SYSTEM - tc->getProcessPtr()->assignThreadContext(tc->contextId()); -#endif + + if (!FullSystem) + tc->getProcessPtr()->assignThreadContext(tc->contextId()); } } @@ -355,11 +346,8 @@ BaseCPU::findContext(ThreadContext *tc) void BaseCPU::switchOut() { -// panic("This CPU doesn't support sampling!"); -#if FULL_SYSTEM if (profileEvent && profileEvent->scheduled()) deschedule(profileEvent); -#endif } void @@ -410,16 +398,16 @@ BaseCPU::takeOverFrom(BaseCPU *oldCPU, Port *ic, Port *dc) } } -#if FULL_SYSTEM interrupts = oldCPU->interrupts; interrupts->setCPU(this); - for (ThreadID i = 0; i < size; ++i) - threadContexts[i]->profileClear(); + if (FullSystem) { + for (ThreadID i = 0; i < size; ++i) + threadContexts[i]->profileClear(); - if (profileEvent) - schedule(profileEvent, curTick()); -#endif + if (profileEvent) + schedule(profileEvent, curTick()); + } // Connect new CPU to old CPU's memory only if new CPU isn't // connected to anything. Also connect old CPU's memory to new @@ -438,7 +426,6 @@ BaseCPU::takeOverFrom(BaseCPU *oldCPU, Port *ic, Port *dc) } -#if FULL_SYSTEM BaseCPU::ProfileEvent::ProfileEvent(BaseCPU *_cpu, Tick _interval) : cpu(_cpu), interval(_interval) { } @@ -469,8 +456,6 @@ BaseCPU::unserialize(Checkpoint *cp, const std::string §ion) interrupts->unserialize(cp, section); } -#endif // FULL_SYSTEM - void BaseCPU::traceFunctionsInternal(Addr pc) { |