62a63
> #include "sim/full_system.hh"
79c80,84
< #if FULL_SYSTEM
---
> static inline void
> panicFsOnlyPseudoInst(const char *name)
> {
> panic("Pseudo inst \"%s\" is only available in Full System mode.");
> }
84,85c89,94
< if (tc->getKernelStats())
< tc->getKernelStats()->arm();
---
> if (FullSystem) {
> if (tc->getKernelStats())
> tc->getKernelStats()->arm();
> } else {
> panicFsOnlyPseudoInst("arm");
> }
91,92c100,102
< if (!tc->getCpuPtr()->params()->do_quiesce)
< return;
---
> if (FullSystem) {
> if (!tc->getCpuPtr()->params()->do_quiesce)
> return;
94c104
< DPRINTF(Quiesce, "%s: quiesce()\n", tc->getCpuPtr()->name());
---
> DPRINTF(Quiesce, "%s: quiesce()\n", tc->getCpuPtr()->name());
96,98c106,111
< tc->suspend();
< if (tc->getKernelStats())
< tc->getKernelStats()->quiesce();
---
> tc->suspend();
> if (tc->getKernelStats())
> tc->getKernelStats()->quiesce();
> } else {
> panicFsOnlyPseudoInst("quiesce");
> }
104c117,118
< BaseCPU *cpu = tc->getCpuPtr();
---
> if (FullSystem) {
> BaseCPU *cpu = tc->getCpuPtr();
106,107c120,121
< if (!cpu->params()->do_quiesce)
< return;
---
> if (!cpu->params()->do_quiesce)
> return;
109c123
< EndQuiesceEvent *quiesceEvent = tc->getQuiesceEvent();
---
> EndQuiesceEvent *quiesceEvent = tc->getQuiesceEvent();
111c125
< Tick resume = curTick() + 1;
---
> Tick resume = curTick() + 1;
113c127
< cpu->reschedule(quiesceEvent, resume, true);
---
> cpu->reschedule(quiesceEvent, resume, true);
115,116c129,130
< DPRINTF(Quiesce, "%s: quiesceSkip() until %d\n",
< cpu->name(), resume);
---
> DPRINTF(Quiesce, "%s: quiesceSkip() until %d\n",
> cpu->name(), resume);
118,120c132,137
< tc->suspend();
< if (tc->getKernelStats())
< tc->getKernelStats()->quiesce();
---
> tc->suspend();
> if (tc->getKernelStats())
> tc->getKernelStats()->quiesce();
> } else {
> panicFsOnlyPseudoInst("quiesceSkip");
> }
126c143,144
< BaseCPU *cpu = tc->getCpuPtr();
---
> if (FullSystem) {
> BaseCPU *cpu = tc->getCpuPtr();
128,129c146,147
< if (!cpu->params()->do_quiesce || ns == 0)
< return;
---
> if (!cpu->params()->do_quiesce || ns == 0)
> return;
131c149
< EndQuiesceEvent *quiesceEvent = tc->getQuiesceEvent();
---
> EndQuiesceEvent *quiesceEvent = tc->getQuiesceEvent();
133c151
< Tick resume = curTick() + SimClock::Int::ns * ns;
---
> Tick resume = curTick() + SimClock::Int::ns * ns;
135c153
< cpu->reschedule(quiesceEvent, resume, true);
---
> cpu->reschedule(quiesceEvent, resume, true);
137,138c155,156
< DPRINTF(Quiesce, "%s: quiesceNs(%d) until %d\n",
< cpu->name(), ns, resume);
---
> DPRINTF(Quiesce, "%s: quiesceNs(%d) until %d\n",
> cpu->name(), ns, resume);
140,142c158,163
< tc->suspend();
< if (tc->getKernelStats())
< tc->getKernelStats()->quiesce();
---
> tc->suspend();
> if (tc->getKernelStats())
> tc->getKernelStats()->quiesce();
> } else {
> panicFsOnlyPseudoInst("quiesceNs");
> }
148c169,170
< BaseCPU *cpu = tc->getCpuPtr();
---
> if (FullSystem) {
> BaseCPU *cpu = tc->getCpuPtr();
150,151c172,173
< if (!cpu->params()->do_quiesce || cycles == 0)
< return;
---
> if (!cpu->params()->do_quiesce || cycles == 0)
> return;
153c175
< EndQuiesceEvent *quiesceEvent = tc->getQuiesceEvent();
---
> EndQuiesceEvent *quiesceEvent = tc->getQuiesceEvent();
155c177
< Tick resume = curTick() + cpu->ticks(cycles);
---
> Tick resume = curTick() + cpu->ticks(cycles);
157c179
< cpu->reschedule(quiesceEvent, resume, true);
---
> cpu->reschedule(quiesceEvent, resume, true);
159,160c181,182
< DPRINTF(Quiesce, "%s: quiesceCycles(%d) until %d\n",
< cpu->name(), cycles, resume);
---
> DPRINTF(Quiesce, "%s: quiesceCycles(%d) until %d\n",
> cpu->name(), cycles, resume);
162,164c184,189
< tc->suspend();
< if (tc->getKernelStats())
< tc->getKernelStats()->quiesce();
---
> tc->suspend();
> if (tc->getKernelStats())
> tc->getKernelStats()->quiesce();
> } else {
> panicFsOnlyPseudoInst("quiesceCycles");
> }
170,171c195,201
< return (tc->readLastActivate() - tc->readLastSuspend()) /
< SimClock::Int::ns;
---
> if (FullSystem) {
> return (tc->readLastActivate() - tc->readLastSuspend()) /
> SimClock::Int::ns;
> } else {
> panicFsOnlyPseudoInst("quiesceTime");
> return 0;
> }
174,175d203
< #endif
<
198,199d225
< #if FULL_SYSTEM
<
203,206c229,233
< const string &filename = tc->getCpuPtr()->system->params()->symbolfile;
< if (filename.empty()) {
< return;
< }
---
> if (FullSystem) {
> const string &filename = tc->getCpuPtr()->system->params()->symbolfile;
> if (filename.empty()) {
> return;
> }
208,209c235,236
< std::string buffer;
< ifstream file(filename.c_str());
---
> std::string buffer;
> ifstream file(filename.c_str());
211,212c238,239
< if (!file)
< fatal("file error: Can't open symbol table file %s\n", filename);
---
> if (!file)
> fatal("file error: Can't open symbol table file %s\n", filename);
214,215c241,242
< while (!file.eof()) {
< getline(file, buffer);
---
> while (!file.eof()) {
> getline(file, buffer);
217,218c244,245
< if (buffer.empty())
< continue;
---
> if (buffer.empty())
> continue;
220,222c247,249
< string::size_type idx = buffer.find(' ');
< if (idx == string::npos)
< continue;
---
> string::size_type idx = buffer.find(' ');
> if (idx == string::npos)
> continue;
224,227c251,254
< string address = "0x" + buffer.substr(0, idx);
< eat_white(address);
< if (address.empty())
< continue;
---
> string address = "0x" + buffer.substr(0, idx);
> eat_white(address);
> if (address.empty())
> continue;
229,233c256,260
< // Skip over letter and space
< string symbol = buffer.substr(idx + 3);
< eat_white(symbol);
< if (symbol.empty())
< continue;
---
> // Skip over letter and space
> string symbol = buffer.substr(idx + 3);
> eat_white(symbol);
> if (symbol.empty())
> continue;
235,237c262,264
< Addr addr;
< if (!to_number(address, addr))
< continue;
---
> Addr addr;
> if (!to_number(address, addr))
> continue;
239,240c266,267
< if (!tc->getSystemPtr()->kernelSymtab->insert(addr, symbol))
< continue;
---
> if (!tc->getSystemPtr()->kernelSymtab->insert(addr, symbol))
> continue;
243c270,274
< DPRINTF(Loader, "Loaded symbol: %s @ %#llx\n", symbol, addr);
---
> DPRINTF(Loader, "Loaded symbol: %s @ %#llx\n", symbol, addr);
> }
> file.close();
> } else {
> panicFsOnlyPseudoInst("loadsymbol");
245d275
< file.close();
251,253c281,284
< char symb[100];
< CopyStringOut(tc, symb, symbolAddr, 100);
< std::string symbol(symb);
---
> if (FullSystem) {
> char symb[100];
> CopyStringOut(tc, symb, symbolAddr, 100);
> std::string symbol(symb);
255c286
< DPRINTF(Loader, "Loaded symbol: %s @ %#llx\n", symbol, addr);
---
> DPRINTF(Loader, "Loaded symbol: %s @ %#llx\n", symbol, addr);
257,258c288,292
< tc->getSystemPtr()->kernelSymtab->insert(addr,symbol);
< debugSymbolTable->insert(addr,symbol);
---
> tc->getSystemPtr()->kernelSymtab->insert(addr,symbol);
> debugSymbolTable->insert(addr,symbol);
> } else {
> panicFsOnlyPseudoInst("addSymbol");
> }
264c298,303
< return tc->getCpuPtr()->system->init_param;
---
> if (FullSystem) {
> return tc->getCpuPtr()->system->init_param;
> } else {
> panicFsOnlyPseudoInst("initParam");
> return 0;
> }
267d305
< #endif
269d306
<
321,322d357
< #if FULL_SYSTEM
<
326,329c361,365
< const string &file = tc->getSystemPtr()->params()->readfile;
< if (file.empty()) {
< return ULL(0);
< }
---
> if (FullSystem) {
> const string &file = tc->getSystemPtr()->params()->readfile;
> if (file.empty()) {
> return ULL(0);
> }
331c367
< uint64_t result = 0;
---
> uint64_t result = 0;
333,335c369,371
< int fd = ::open(file.c_str(), O_RDONLY, 0);
< if (fd < 0)
< panic("could not open file %s\n", file);
---
> int fd = ::open(file.c_str(), O_RDONLY, 0);
> if (fd < 0)
> panic("could not open file %s\n", file);
337,338c373,374
< if (::lseek(fd, offset, SEEK_SET) < 0)
< panic("could not seek: %s", strerror(errno));
---
> if (::lseek(fd, offset, SEEK_SET) < 0)
> panic("could not seek: %s", strerror(errno));
340,345c376,381
< char *buf = new char[len];
< char *p = buf;
< while (len > 0) {
< int bytes = ::read(fd, p, len);
< if (bytes <= 0)
< break;
---
> char *buf = new char[len];
> char *p = buf;
> while (len > 0) {
> int bytes = ::read(fd, p, len);
> if (bytes <= 0)
> break;
347,350c383,386
< p += bytes;
< result += bytes;
< len -= bytes;
< }
---
> p += bytes;
> result += bytes;
> len -= bytes;
> }
352,355c388,395
< close(fd);
< CopyIn(tc, vaddr, buf, result);
< delete [] buf;
< return result;
---
> close(fd);
> CopyIn(tc, vaddr, buf, result);
> delete [] buf;
> return result;
> } else {
> panicFsOnlyPseudoInst("readfile");
> return 0;
> }
358,359d397
< #endif
<