summaryrefslogtreecommitdiff
path: root/src/sim/pseudo_inst.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim/pseudo_inst.cc')
-rw-r--r--src/sim/pseudo_inst.cc59
1 files changed, 43 insertions, 16 deletions
diff --git a/src/sim/pseudo_inst.cc b/src/sim/pseudo_inst.cc
index 4e6c46f8e..8a7f0c469 100644
--- a/src/sim/pseudo_inst.cc
+++ b/src/sim/pseudo_inst.cc
@@ -48,10 +48,10 @@
#include <fstream>
#include <string>
+#include "arch/kernel_stats.hh"
#include "arch/vtophys.hh"
#include "base/debug.hh"
#include "base/output.hh"
-#include "config/full_system.hh"
#include "config/the_isa.hh"
#include "cpu/base.hh"
#include "cpu/quiesce_event.hh"
@@ -60,6 +60,7 @@
#include "debug/Quiesce.hh"
#include "debug/WorkItems.hh"
#include "params/BaseCPU.hh"
+#include "sim/full_system.hh"
#include "sim/pseudo_inst.hh"
#include "sim/serialize.hh"
#include "sim/sim_events.hh"
@@ -67,11 +68,7 @@
#include "sim/stat_control.hh"
#include "sim/stats.hh"
#include "sim/system.hh"
-
-#if FULL_SYSTEM
-#include "arch/kernel_stats.hh"
#include "sim/vptr.hh"
-#endif
using namespace std;
@@ -80,11 +77,18 @@ using namespace TheISA;
namespace PseudoInst {
-#if FULL_SYSTEM
+static inline void
+panicFsOnlyPseudoInst(const char *name)
+{
+ panic("Pseudo inst \"%s\" is only available in Full System mode.");
+}
void
arm(ThreadContext *tc)
{
+ if (!FullSystem)
+ panicFsOnlyPseudoInst("arm");
+
if (tc->getKernelStats())
tc->getKernelStats()->arm();
}
@@ -92,6 +96,9 @@ arm(ThreadContext *tc)
void
quiesce(ThreadContext *tc)
{
+ if (!FullSystem)
+ panicFsOnlyPseudoInst("quiesce");
+
if (!tc->getCpuPtr()->params()->do_quiesce)
return;
@@ -105,6 +112,9 @@ quiesce(ThreadContext *tc)
void
quiesceSkip(ThreadContext *tc)
{
+ if (!FullSystem)
+ panicFsOnlyPseudoInst("quiesceSkip");
+
BaseCPU *cpu = tc->getCpuPtr();
if (!cpu->params()->do_quiesce)
@@ -127,6 +137,9 @@ quiesceSkip(ThreadContext *tc)
void
quiesceNs(ThreadContext *tc, uint64_t ns)
{
+ if (!FullSystem)
+ panicFsOnlyPseudoInst("quiesceNs");
+
BaseCPU *cpu = tc->getCpuPtr();
if (!cpu->params()->do_quiesce || ns == 0)
@@ -149,6 +162,9 @@ quiesceNs(ThreadContext *tc, uint64_t ns)
void
quiesceCycles(ThreadContext *tc, uint64_t cycles)
{
+ if (!FullSystem)
+ panicFsOnlyPseudoInst("quiesceCycles");
+
BaseCPU *cpu = tc->getCpuPtr();
if (!cpu->params()->do_quiesce || cycles == 0)
@@ -171,12 +187,15 @@ quiesceCycles(ThreadContext *tc, uint64_t cycles)
uint64_t
quiesceTime(ThreadContext *tc)
{
+ if (!FullSystem) {
+ panicFsOnlyPseudoInst("quiesceTime");
+ return 0;
+ }
+
return (tc->readLastActivate() - tc->readLastSuspend()) /
SimClock::Int::ns;
}
-#endif
-
uint64_t
rpns(ThreadContext *tc)
{
@@ -199,11 +218,12 @@ m5exit(ThreadContext *tc, Tick delay)
exitSimLoop("m5_exit instruction encountered", 0, when);
}
-#if FULL_SYSTEM
-
void
loadsymbol(ThreadContext *tc)
{
+ if (!FullSystem)
+ panicFsOnlyPseudoInst("loadsymbol");
+
const string &filename = tc->getCpuPtr()->system->params()->symbolfile;
if (filename.empty()) {
return;
@@ -252,6 +272,9 @@ loadsymbol(ThreadContext *tc)
void
addsymbol(ThreadContext *tc, Addr addr, Addr symbolAddr)
{
+ if (!FullSystem)
+ panicFsOnlyPseudoInst("addSymbol");
+
char symb[100];
CopyStringOut(tc, symb, symbolAddr, 100);
std::string symbol(symb);
@@ -265,11 +288,14 @@ addsymbol(ThreadContext *tc, Addr addr, Addr symbolAddr)
uint64_t
initParam(ThreadContext *tc)
{
+ if (!FullSystem) {
+ panicFsOnlyPseudoInst("initParam");
+ return 0;
+ }
+
return tc->getCpuPtr()->system->init_param;
}
-#endif
-
void
resetstats(ThreadContext *tc, Tick delay, Tick period)
@@ -322,11 +348,14 @@ m5checkpoint(ThreadContext *tc, Tick delay, Tick period)
exitSimLoop("checkpoint", 0, when, repeat);
}
-#if FULL_SYSTEM
-
uint64_t
readfile(ThreadContext *tc, Addr vaddr, uint64_t len, uint64_t offset)
{
+ if (!FullSystem) {
+ panicFsOnlyPseudoInst("readfile");
+ return 0;
+ }
+
const string &file = tc->getSystemPtr()->params()->readfile;
if (file.empty()) {
return ULL(0);
@@ -401,8 +430,6 @@ writefile(ThreadContext *tc, Addr vaddr, uint64_t len, uint64_t offset,
return len;
}
-#endif
-
void
debugbreak(ThreadContext *tc)
{