summaryrefslogtreecommitdiff
path: root/src/cpu/base.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu/base.cc')
-rw-r--r--src/cpu/base.cc53
1 files changed, 19 insertions, 34 deletions
diff --git a/src/cpu/base.cc b/src/cpu/base.cc
index 76c7c964b..6e2de0baf 100644
--- a/src/cpu/base.cc
+++ b/src/cpu/base.cc
@@ -47,6 +47,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"
@@ -100,18 +101,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();
@@ -202,13 +196,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;
}
@@ -232,10 +226,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);
@@ -274,9 +268,6 @@ BaseCPU::regStats()
}
} else if (size == 1)
threadContexts[0]->regStats(name());
-
-#if FULL_SYSTEM
-#endif
}
Tick
@@ -318,9 +309,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());
}
}
@@ -339,11 +330,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
@@ -394,16 +382,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
@@ -422,7 +410,6 @@ BaseCPU::takeOverFrom(BaseCPU *oldCPU, Port *ic, Port *dc)
}
-#if FULL_SYSTEM
BaseCPU::ProfileEvent::ProfileEvent(BaseCPU *_cpu, Tick _interval)
: cpu(_cpu), interval(_interval)
{ }
@@ -453,8 +440,6 @@ BaseCPU::unserialize(Checkpoint *cp, const std::string &section)
interrupts->unserialize(cp, section);
}
-#endif // FULL_SYSTEM
-
void
BaseCPU::traceFunctionsInternal(Addr pc)
{