#include <string>
#include "arch/vtophys.hh"
-#include "base/annotate.hh"
+#include "base/debug.hh"
+#include "config/full_system.hh"
+#include "config/the_isa.hh"
#include "cpu/base.hh"
#include "cpu/thread_context.hh"
#include "cpu/quiesce_event.hh"
-#include "arch/kernel_stats.hh"
+#include "params/BaseCPU.hh"
#include "sim/pseudo_inst.hh"
#include "sim/serialize.hh"
+#include "sim/sim_events.hh"
#include "sim/sim_exit.hh"
#include "sim/stat_control.hh"
#include "sim/stats.hh"
#include "sim/system.hh"
-#include "sim/debug.hh"
+
+#if FULL_SYSTEM
+#include "arch/kernel_stats.hh"
#include "sim/vptr.hh"
+#endif
using namespace std;
namespace PseudoInst {
+#if FULL_SYSTEM
+
void
arm(ThreadContext *tc)
{
void
quiesce(ThreadContext *tc)
{
- if (!tc->getCpuPtr()->params->do_quiesce)
+ if (!tc->getCpuPtr()->params()->do_quiesce)
return;
DPRINTF(Quiesce, "%s: quiesce()\n", tc->getCpuPtr()->name());
void
quiesceNs(ThreadContext *tc, uint64_t ns)
{
- if (!tc->getCpuPtr()->params->do_quiesce || ns == 0)
+ if (!tc->getCpuPtr()->params()->do_quiesce || ns == 0)
return;
EndQuiesceEvent *quiesceEvent = tc->getQuiesceEvent();
- Tick resume = curTick + Clock::Int::ns * ns;
+ Tick resume = curTick + SimClock::Int::ns * ns;
- quiesceEvent->reschedule(resume, true);
+ mainEventQueue.reschedule(quiesceEvent, resume, true);
DPRINTF(Quiesce, "%s: quiesceNs(%d) until %d\n",
tc->getCpuPtr()->name(), ns, resume);
void
quiesceCycles(ThreadContext *tc, uint64_t cycles)
{
- if (!tc->getCpuPtr()->params->do_quiesce || cycles == 0)
+ if (!tc->getCpuPtr()->params()->do_quiesce || cycles == 0)
return;
EndQuiesceEvent *quiesceEvent = tc->getQuiesceEvent();
Tick resume = curTick + tc->getCpuPtr()->ticks(cycles);
- quiesceEvent->reschedule(resume, true);
+ mainEventQueue.reschedule(quiesceEvent, resume, true);
DPRINTF(Quiesce, "%s: quiesceCycles(%d) until %d\n",
tc->getCpuPtr()->name(), cycles, resume);
uint64_t
quiesceTime(ThreadContext *tc)
{
- return (tc->readLastActivate() - tc->readLastSuspend()) / Clock::Int::ns;
+ return (tc->readLastActivate() - tc->readLastSuspend()) /
+ SimClock::Int::ns;
+}
+
+#endif
+
+uint64_t
+rpns(ThreadContext *tc)
+{
+ return curTick / SimClock::Int::ns;
+}
+
+void
+wakeCPU(ThreadContext *tc, uint64_t cpuid)
+{
+ System *sys = tc->getSystemPtr();
+ ThreadContext *other_tc = sys->threadContexts[cpuid];
+ if (other_tc->status() == ThreadContext::Suspended)
+ other_tc->activate();
}
void
m5exit(ThreadContext *tc, Tick delay)
{
- Tick when = curTick + delay * Clock::Int::ns;
- schedExitSimLoop("m5_exit instruction encountered", when);
+ Tick when = curTick + delay * SimClock::Int::ns;
+ Event *event = new SimLoopExitEvent("m5_exit instruction encountered", 0);
+ mainEventQueue.schedule(event, when);
}
+#if FULL_SYSTEM
+
void
loadsymbol(ThreadContext *tc)
{
if (buffer.empty())
continue;
- int idx = buffer.find(' ');
+ string::size_type idx = buffer.find(' ');
if (idx == string::npos)
continue;
}
void
-resetstats(ThreadContext *tc, Tick delay, Tick period)
+addsymbol(ThreadContext *tc, Addr addr, Addr symbolAddr)
{
- if (!tc->getCpuPtr()->params->do_statistics_insts)
- return;
-
+ char symb[100];
+ CopyStringOut(tc, symb, symbolAddr, 100);
+ std::string symbol(symb);
- Tick when = curTick + delay * Clock::Int::ns;
- Tick repeat = period * Clock::Int::ns;
+ DPRINTF(Loader, "Loaded symbol: %s @ %#llx\n", symbol, addr);
- Stats::StatEvent(false, true, when, repeat);
+ tc->getSystemPtr()->kernelSymtab->insert(addr,symbol);
+ debugSymbolTable->insert(addr,symbol);
}
+#endif
+
+
void
-dumpstats(ThreadContext *tc, Tick delay, Tick period)
+resetstats(ThreadContext *tc, Tick delay, Tick period)
{
- if (!tc->getCpuPtr()->params->do_statistics_insts)
+ if (!tc->getCpuPtr()->params()->do_statistics_insts)
return;
- Tick when = curTick + delay * Clock::Int::ns;
- Tick repeat = period * Clock::Int::ns;
+ Tick when = curTick + delay * SimClock::Int::ns;
+ Tick repeat = period * SimClock::Int::ns;
- Stats::StatEvent(true, false, when, repeat);
+ Stats::StatEvent(false, true, when, repeat);
}
void
-addsymbol(ThreadContext *tc, Addr addr, Addr symbolAddr)
+dumpstats(ThreadContext *tc, Tick delay, Tick period)
{
- char symb[100];
- CopyStringOut(tc, symb, symbolAddr, 100);
- std::string symbol(symb);
+ if (!tc->getCpuPtr()->params()->do_statistics_insts)
+ return;
- DPRINTF(Loader, "Loaded symbol: %s @ %#llx\n", symbol, addr);
- tc->getSystemPtr()->kernelSymtab->insert(addr,symbol);
+ Tick when = curTick + delay * SimClock::Int::ns;
+ Tick repeat = period * SimClock::Int::ns;
+
+ Stats::StatEvent(true, false, when, repeat);
}
void
dumpresetstats(ThreadContext *tc, Tick delay, Tick period)
{
- if (!tc->getCpuPtr()->params->do_statistics_insts)
+ if (!tc->getCpuPtr()->params()->do_statistics_insts)
return;
- Tick when = curTick + delay * Clock::Int::ns;
- Tick repeat = period * Clock::Int::ns;
+ Tick when = curTick + delay * SimClock::Int::ns;
+ Tick repeat = period * SimClock::Int::ns;
Stats::StatEvent(true, true, when, repeat);
}
void
m5checkpoint(ThreadContext *tc, Tick delay, Tick period)
{
- if (!tc->getCpuPtr()->params->do_checkpoint_insts)
+ if (!tc->getCpuPtr()->params()->do_checkpoint_insts)
return;
- Tick when = curTick + delay * Clock::Int::ns;
- Tick repeat = period * Clock::Int::ns;
+ Tick when = curTick + delay * SimClock::Int::ns;
+ Tick repeat = period * SimClock::Int::ns;
- schedExitSimLoop("checkpoint", when, repeat);
+ Event *event = new SimLoopExitEvent("checkpoint", 0, repeat);
+ mainEventQueue.schedule(event, when);
}
+#if FULL_SYSTEM
+
uint64_t
readfile(ThreadContext *tc, Addr vaddr, uint64_t len, uint64_t offset)
{
return result;
}
+#endif
+
void
debugbreak(ThreadContext *tc)
{