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 f9ae9ce5d..977769126 100644 --- a/src/cpu/base.cc +++ b/src/cpu/base.cc @@ -60,6 +60,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" @@ -117,18 +118,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(); @@ -223,16 +217,16 @@ BaseCPU::BaseCPU(Params *p) schedule(event, p->function_trace_start); } } -#if FULL_SYSTEM // Check if CPU model has interrupts connected. The CheckerCPU // cannot take interrupts directly for example. if (interrupts) 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; } @@ -256,10 +250,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); @@ -298,9 +292,6 @@ BaseCPU::regStats() } } else if (size == 1) threadContexts[0]->regStats(name()); - -#if FULL_SYSTEM -#endif } Tick @@ -342,9 +333,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()); } } @@ -363,11 +354,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 @@ -449,16 +437,16 @@ BaseCPU::takeOverFrom(BaseCPU *oldCPU) } -#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 @@ -477,7 +465,6 @@ BaseCPU::takeOverFrom(BaseCPU *oldCPU) } -#if FULL_SYSTEM BaseCPU::ProfileEvent::ProfileEvent(BaseCPU *_cpu, Tick _interval) : cpu(_cpu), interval(_interval) { } @@ -508,8 +495,6 @@ BaseCPU::unserialize(Checkpoint *cp, const std::string §ion) interrupts->unserialize(cp, section); } -#endif // FULL_SYSTEM - void BaseCPU::traceFunctionsInternal(Addr pc) { |