summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/SConscript12
-rw-r--r--src/sim/System.py18
-rw-r--r--src/sim/faults.cc12
-rw-r--r--src/sim/faults.hh1
-rw-r--r--src/sim/process.cc11
-rw-r--r--src/sim/process.hh11
-rw-r--r--src/sim/process_impl.hh12
-rw-r--r--src/sim/pseudo_inst.cc276
-rw-r--r--src/sim/pseudo_inst.hh67
-rw-r--r--src/sim/syscall_emul.hh1
-rw-r--r--src/sim/system.cc176
-rw-r--r--src/sim/system.hh40
-rw-r--r--src/sim/tlb.cc16
13 files changed, 269 insertions, 384 deletions
diff --git a/src/sim/SConscript b/src/sim/SConscript
index 041c3ac10..25b965d59 100644
--- a/src/sim/SConscript
+++ b/src/sim/SConscript
@@ -34,6 +34,7 @@ SimObject('BaseTLB.py')
SimObject('Root.py')
SimObject('InstTracer.py')
+Source('arguments.cc')
Source('async.cc')
Source('core.cc')
Source('debug.cc')
@@ -46,21 +47,18 @@ Source('sim_events.cc')
Source('sim_object.cc')
Source('simulate.cc')
Source('stat_control.cc')
+Source('syscall_emul.cc')
if env['TARGET_ISA'] != 'no':
+ SimObject('Process.py')
SimObject('System.py')
Source('faults.cc')
+ Source('process.cc')
Source('pseudo_inst.cc')
Source('system.cc')
-if env['FULL_SYSTEM']:
- Source('arguments.cc')
-elif env['TARGET_ISA'] != 'no':
+if env['TARGET_ISA'] != 'no':
Source('tlb.cc')
- SimObject('Process.py')
-
- Source('process.cc')
- Source('syscall_emul.cc')
DebugFlag('Checkpoint')
DebugFlag('Config')
diff --git a/src/sim/System.py b/src/sim/System.py
index d9836211f..db214abc0 100644
--- a/src/sim/System.py
+++ b/src/sim/System.py
@@ -69,14 +69,10 @@ class System(SimObject):
work_cpus_ckpt_count = Param.Counter(0,
"create checkpoint when active cpu count value is reached")
- if buildEnv['FULL_SYSTEM']:
- abstract = True
- boot_cpu_frequency = Param.Frequency(Self.cpu[0].clock.frequency,
- "boot processor frequency")
- init_param = Param.UInt64(0, "numerical value to pass into simulator")
- boot_osflags = Param.String("a", "boot flags to pass to the kernel")
- kernel = Param.String("", "file that contains the kernel code")
- readfile = Param.String("", "file to read startup script from")
- symbolfile = Param.String("", "file to get the symbols from")
- load_addr_mask = Param.UInt64(0xffffffffff,
- "Address to mask loading binaries with");
+ init_param = Param.UInt64(0, "numerical value to pass into simulator")
+ boot_osflags = Param.String("a", "boot flags to pass to the kernel")
+ kernel = Param.String("", "file that contains the kernel code")
+ readfile = Param.String("", "file to read startup script from")
+ symbolfile = Param.String("", "file to get the symbols from")
+ load_addr_mask = Param.UInt64(0xffffffffff,
+ "Address to mask loading binaries with");
diff --git a/src/sim/faults.cc b/src/sim/faults.cc
index 6403953db..c409aa95b 100644
--- a/src/sim/faults.cc
+++ b/src/sim/faults.cc
@@ -36,11 +36,12 @@
#include "debug/Fault.hh"
#include "mem/page_table.hh"
#include "sim/faults.hh"
+#include "sim/full_system.hh"
#include "sim/process.hh"
void FaultBase::invoke(ThreadContext * tc, StaticInstPtr inst)
{
- if (FULL_SYSTEM) {
+ if (FullSystem) {
DPRINTF(Fault, "Fault %s at PC: %s\n", name(), tc->pcState());
assert(!tc->misspeculating());
} else {
@@ -61,11 +62,10 @@ void ReExec::invoke(ThreadContext *tc, StaticInstPtr inst)
void GenericPageTableFault::invoke(ThreadContext *tc, StaticInstPtr inst)
{
bool handled = false;
-#if !FULL_SYSTEM
- Process *p = tc->getProcessPtr();
-
- handled = p->fixupStackFault(vaddr);
-#endif
+ if (!FullSystem) {
+ Process *p = tc->getProcessPtr();
+ handled = p->fixupStackFault(vaddr);
+ }
if (!handled)
panic("Page table fault when accessing virtual address %#x\n", vaddr);
diff --git a/src/sim/faults.hh b/src/sim/faults.hh
index 0b2d3be10..4cdb24aee 100644
--- a/src/sim/faults.hh
+++ b/src/sim/faults.hh
@@ -34,7 +34,6 @@
#include "base/refcnt.hh"
#include "base/types.hh"
-#include "config/full_system.hh"
#include "cpu/static_inst.hh"
#include "sim/fault_fwd.hh"
#include "sim/stats.hh"
diff --git a/src/sim/process.cc b/src/sim/process.cc
index 1714a87dc..c400b72ee 100644
--- a/src/sim/process.cc
+++ b/src/sim/process.cc
@@ -40,7 +40,6 @@
#include "base/loader/symtab.hh"
#include "base/intmath.hh"
#include "base/statistics.hh"
-#include "config/full_system.hh"
#include "config/the_isa.hh"
#include "cpu/thread_context.hh"
#include "mem/page_table.hh"
@@ -77,15 +76,6 @@
using namespace std;
using namespace TheISA;
-//
-// The purpose of this code is to fake the loader & syscall mechanism
-// when there's no OS: thus there's no resone to use it in FULL_SYSTEM
-// mode when we do have an OS
-//
-#if FULL_SYSTEM
-#error "process.cc not compatible with FULL_SYSTEM"
-#endif
-
// current number of allocated processes
int num_processes = 0;
@@ -728,7 +718,6 @@ LiveProcess::create(LiveProcessParams * params)
#error "THE_ISA not set"
#endif
-
if (process == NULL)
fatal("Unknown error creating process object.");
return process;
diff --git a/src/sim/process.hh b/src/sim/process.hh
index 4c31597b4..f738bb38a 100644
--- a/src/sim/process.hh
+++ b/src/sim/process.hh
@@ -32,15 +32,6 @@
#ifndef __PROCESS_HH__
#define __PROCESS_HH__
-//
-// The purpose of this code is to fake the loader & syscall mechanism
-// when there's no OS: thus there's no reason to use it in FULL_SYSTEM
-// mode when we do have an OS.
-//
-#include "config/full_system.hh"
-
-#if !FULL_SYSTEM
-
#include <string>
#include <vector>
@@ -319,6 +310,4 @@ class LiveProcess : public Process
};
-#endif // !FULL_SYSTEM
-
#endif // __PROCESS_HH__
diff --git a/src/sim/process_impl.hh b/src/sim/process_impl.hh
index b5333858c..944c55ec0 100644
--- a/src/sim/process_impl.hh
+++ b/src/sim/process_impl.hh
@@ -32,15 +32,6 @@
#ifndef __SIM_PROCESS_IMPL_HH__
#define __SIM_PROCESS_IMPL_HH__
-//
-// The purpose of this code is to fake the loader & syscall mechanism
-// when there's no OS: thus there's no reason to use it in FULL_SYSTEM
-// mode when we do have an OS.
-//
-#include "config/full_system.hh"
-
-#if !FULL_SYSTEM
-
#include <string>
#include <vector>
@@ -69,7 +60,4 @@ copyStringArray(std::vector<std::string> &strings,
memPort->writeBlob(array_ptr, (uint8_t*)&data_ptr, sizeof(AddrType));
}
-
-#endif // !FULL_SYSTEM
-
#endif
diff --git a/src/sim/pseudo_inst.cc b/src/sim/pseudo_inst.cc
index 2062dfb8c..749afeb3b 100644
--- a/src/sim/pseudo_inst.cc
+++ b/src/sim/pseudo_inst.cc
@@ -48,9 +48,9 @@
#include <fstream>
#include <string>
+#include "arch/kernel_stats.hh"
#include "arch/vtophys.hh"
#include "base/debug.hh"
-#include "config/full_system.hh"
#include "config/the_isa.hh"
#include "cpu/base.hh"
#include "cpu/quiesce_event.hh"
@@ -59,6 +59,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"
@@ -66,11 +67,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;
@@ -79,103 +76,130 @@ 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 (tc->getKernelStats())
- tc->getKernelStats()->arm();
+ if (FullSystem) {
+ if (tc->getKernelStats())
+ tc->getKernelStats()->arm();
+ } else {
+ panicFsOnlyPseudoInst("arm");
+ }
}
void
quiesce(ThreadContext *tc)
{
- if (!tc->getCpuPtr()->params()->do_quiesce)
- return;
+ if (FullSystem) {
+ if (!tc->getCpuPtr()->params()->do_quiesce)
+ return;
- DPRINTF(Quiesce, "%s: quiesce()\n", tc->getCpuPtr()->name());
+ DPRINTF(Quiesce, "%s: quiesce()\n", tc->getCpuPtr()->name());
- tc->suspend();
- if (tc->getKernelStats())
- tc->getKernelStats()->quiesce();
+ tc->suspend();
+ if (tc->getKernelStats())
+ tc->getKernelStats()->quiesce();
+ } else {
+ panicFsOnlyPseudoInst("quiesce");
+ }
}
void
quiesceSkip(ThreadContext *tc)
{
- BaseCPU *cpu = tc->getCpuPtr();
+ if (FullSystem) {
+ BaseCPU *cpu = tc->getCpuPtr();
- if (!cpu->params()->do_quiesce)
- return;
+ if (!cpu->params()->do_quiesce)
+ return;
- EndQuiesceEvent *quiesceEvent = tc->getQuiesceEvent();
+ EndQuiesceEvent *quiesceEvent = tc->getQuiesceEvent();
- Tick resume = curTick() + 1;
+ Tick resume = curTick() + 1;
- cpu->reschedule(quiesceEvent, resume, true);
+ cpu->reschedule(quiesceEvent, resume, true);
- DPRINTF(Quiesce, "%s: quiesceSkip() until %d\n",
- cpu->name(), resume);
+ DPRINTF(Quiesce, "%s: quiesceSkip() until %d\n",
+ cpu->name(), resume);
- tc->suspend();
- if (tc->getKernelStats())
- tc->getKernelStats()->quiesce();
+ tc->suspend();
+ if (tc->getKernelStats())
+ tc->getKernelStats()->quiesce();
+ } else {
+ panicFsOnlyPseudoInst("quiesceSkip");
+ }
}
void
quiesceNs(ThreadContext *tc, uint64_t ns)
{
- BaseCPU *cpu = tc->getCpuPtr();
+ if (FullSystem) {
+ BaseCPU *cpu = tc->getCpuPtr();
- if (!cpu->params()->do_quiesce || ns == 0)
- return;
+ if (!cpu->params()->do_quiesce || ns == 0)
+ return;
- EndQuiesceEvent *quiesceEvent = tc->getQuiesceEvent();
+ EndQuiesceEvent *quiesceEvent = tc->getQuiesceEvent();
- Tick resume = curTick() + SimClock::Int::ns * ns;
+ Tick resume = curTick() + SimClock::Int::ns * ns;
- cpu->reschedule(quiesceEvent, resume, true);
+ cpu->reschedule(quiesceEvent, resume, true);
- DPRINTF(Quiesce, "%s: quiesceNs(%d) until %d\n",
- cpu->name(), ns, resume);
+ DPRINTF(Quiesce, "%s: quiesceNs(%d) until %d\n",
+ cpu->name(), ns, resume);
- tc->suspend();
- if (tc->getKernelStats())
- tc->getKernelStats()->quiesce();
+ tc->suspend();
+ if (tc->getKernelStats())
+ tc->getKernelStats()->quiesce();
+ } else {
+ panicFsOnlyPseudoInst("quiesceNs");
+ }
}
void
quiesceCycles(ThreadContext *tc, uint64_t cycles)
{
- BaseCPU *cpu = tc->getCpuPtr();
+ if (FullSystem) {
+ BaseCPU *cpu = tc->getCpuPtr();
- if (!cpu->params()->do_quiesce || cycles == 0)
- return;
+ if (!cpu->params()->do_quiesce || cycles == 0)
+ return;
- EndQuiesceEvent *quiesceEvent = tc->getQuiesceEvent();
+ EndQuiesceEvent *quiesceEvent = tc->getQuiesceEvent();
- Tick resume = curTick() + cpu->ticks(cycles);
+ Tick resume = curTick() + cpu->ticks(cycles);
- cpu->reschedule(quiesceEvent, resume, true);
+ cpu->reschedule(quiesceEvent, resume, true);
- DPRINTF(Quiesce, "%s: quiesceCycles(%d) until %d\n",
- cpu->name(), cycles, resume);
+ DPRINTF(Quiesce, "%s: quiesceCycles(%d) until %d\n",
+ cpu->name(), cycles, resume);
- tc->suspend();
- if (tc->getKernelStats())
- tc->getKernelStats()->quiesce();
+ tc->suspend();
+ if (tc->getKernelStats())
+ tc->getKernelStats()->quiesce();
+ } else {
+ panicFsOnlyPseudoInst("quiesceCycles");
+ }
}
uint64_t
quiesceTime(ThreadContext *tc)
{
- return (tc->readLastActivate() - tc->readLastSuspend()) /
- SimClock::Int::ns;
+ if (FullSystem) {
+ return (tc->readLastActivate() - tc->readLastSuspend()) /
+ SimClock::Int::ns;
+ } else {
+ panicFsOnlyPseudoInst("quiesceTime");
+ return 0;
+ }
}
-#endif
-
uint64_t
rpns(ThreadContext *tc)
{
@@ -198,77 +222,86 @@ m5exit(ThreadContext *tc, Tick delay)
exitSimLoop("m5_exit instruction encountered", 0, when);
}
-#if FULL_SYSTEM
-
void
loadsymbol(ThreadContext *tc)
{
- 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;
+ }
- std::string buffer;
- ifstream file(filename.c_str());
+ std::string buffer;
+ ifstream file(filename.c_str());
- 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);
- while (!file.eof()) {
- getline(file, buffer);
+ while (!file.eof()) {
+ getline(file, buffer);
- if (buffer.empty())
- continue;
+ if (buffer.empty())
+ continue;
- string::size_type idx = buffer.find(' ');
- if (idx == string::npos)
- continue;
+ string::size_type idx = buffer.find(' ');
+ if (idx == string::npos)
+ continue;
- 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;
- // 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;
- Addr addr;
- if (!to_number(address, addr))
- continue;
+ Addr addr;
+ if (!to_number(address, addr))
+ continue;
- if (!tc->getSystemPtr()->kernelSymtab->insert(addr, symbol))
- continue;
+ if (!tc->getSystemPtr()->kernelSymtab->insert(addr, symbol))
+ continue;
- DPRINTF(Loader, "Loaded symbol: %s @ %#llx\n", symbol, addr);
+ DPRINTF(Loader, "Loaded symbol: %s @ %#llx\n", symbol, addr);
+ }
+ file.close();
+ } else {
+ panicFsOnlyPseudoInst("loadsymbol");
}
- file.close();
}
void
addsymbol(ThreadContext *tc, Addr addr, Addr symbolAddr)
{
- 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);
- DPRINTF(Loader, "Loaded symbol: %s @ %#llx\n", symbol, addr);
+ DPRINTF(Loader, "Loaded symbol: %s @ %#llx\n", symbol, addr);
- tc->getSystemPtr()->kernelSymtab->insert(addr,symbol);
- debugSymbolTable->insert(addr,symbol);
+ tc->getSystemPtr()->kernelSymtab->insert(addr,symbol);
+ debugSymbolTable->insert(addr,symbol);
+ } else {
+ panicFsOnlyPseudoInst("addSymbol");
+ }
}
uint64_t
initParam(ThreadContext *tc)
{
- return tc->getCpuPtr()->system->init_param;
+ if (FullSystem) {
+ return tc->getCpuPtr()->system->init_param;
+ } else {
+ panicFsOnlyPseudoInst("initParam");
+ return 0;
+ }
}
-#endif
-
void
resetstats(ThreadContext *tc, Tick delay, Tick period)
@@ -321,45 +354,46 @@ 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)
{
- 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);
+ }
- uint64_t result = 0;
+ uint64_t result = 0;
- 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);
- 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));
- 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;
- p += bytes;
- result += bytes;
- len -= bytes;
- }
+ p += bytes;
+ result += bytes;
+ len -= bytes;
+ }
- 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;
+ }
}
-#endif
-
void
debugbreak(ThreadContext *tc)
{
diff --git a/src/sim/pseudo_inst.hh b/src/sim/pseudo_inst.hh
index 673ec6170..399c88a4f 100644
--- a/src/sim/pseudo_inst.hh
+++ b/src/sim/pseudo_inst.hh
@@ -45,8 +45,6 @@ extern bool doStatisticsInsts;
extern bool doCheckpointInsts;
extern bool doQuiesce;
-#if FULL_SYSTEM
-
void arm(ThreadContext *tc);
void quiesce(ThreadContext *tc);
void quiesceSkip(ThreadContext *tc);
@@ -58,71 +56,6 @@ uint64_t readfile(ThreadContext *tc, Addr vaddr, uint64_t len,
void loadsymbol(ThreadContext *xc);
void addsymbol(ThreadContext *tc, Addr addr, Addr symbolAddr);
uint64_t initParam(ThreadContext *xc);
-
-#else
-
-static inline void
-panicFsOnlyPseudoInst(const char *name)
-{
- panic("Pseudo inst \"%s\" is only available in Full System mode.");
-}
-
-static inline void
-arm(ThreadContext *tc)
-{
- panicFsOnlyPseudoInst("arm");
-}
-static inline void
-quiesce(ThreadContext *tc)
-{
- panicFsOnlyPseudoInst("quiesce");
-}
-static inline void
-quiesceSkip(ThreadContext *tc)
-{
- panicFsOnlyPseudoInst("quiesceSkip");
-}
-static inline void
-quiesceNs(ThreadContext *tc, uint64_t ns)
-{
- panicFsOnlyPseudoInst("quiesceNs");
-}
-static inline void
-quiesceCycles(ThreadContext *tc, uint64_t cycles)
-{
- panicFsOnlyPseudoInst("quiesceCycles");
-}
-static inline uint64_t
-quiesceTime(ThreadContext *tc)
-{
- panicFsOnlyPseudoInst("quiesceTime");
- return 0;
-}
-static inline uint64_t
-readfile(ThreadContext *tc, Addr vaddr, uint64_t len, uint64_t offset)
-{
- panicFsOnlyPseudoInst("readFile");
- return 0;
-}
-static inline void
-loadsymbol(ThreadContext *xc)
-{
- panicFsOnlyPseudoInst("loadSymbol");
-}
-static inline void
-addsymbol(ThreadContext *tc, Addr addr, Addr symbolAddr)
-{
- panicFsOnlyPseudoInst("addSymbol");
-}
-static inline uint64_t
-initParam(ThreadContext *tc)
-{
- panicFsOnlyPseudoInst("initParam");
- return 0;
-}
-
-#endif
-
uint64_t rpns(ThreadContext *tc);
void wakeCPU(ThreadContext *tc, uint64_t cpuid);
void m5exit(ThreadContext *tc, Tick delay);
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 50bf1a52f..5c480272d 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -65,6 +65,7 @@
#include "mem/translating_port.hh"
#include "sim/byteswap.hh"
#include "sim/process.hh"
+#include "sim/syscallreturn.hh"
#include "sim/system.hh"
///
diff --git a/src/sim/system.cc b/src/sim/system.cc
index c58830c10..3051cb64b 100644
--- a/src/sim/system.cc
+++ b/src/sim/system.cc
@@ -36,27 +36,23 @@
#include "arch/isa_traits.hh"
#include "arch/remote_gdb.hh"
#include "arch/utility.hh"
+#include "arch/vtophys.hh"
#include "base/loader/object_file.hh"
#include "base/loader/symtab.hh"
#include "base/trace.hh"
-#include "config/full_system.hh"
#include "config/the_isa.hh"
#include "cpu/thread_context.hh"
#include "debug/Loader.hh"
+#include "kern/kernel_stats.hh"
#include "mem/mem_object.hh"
#include "mem/physical.hh"
+#include "mem/vport.hh"
+#include "params/System.hh"
#include "sim/byteswap.hh"
#include "sim/debug.hh"
+#include "sim/full_system.hh"
#include "sim/system.hh"
-#if FULL_SYSTEM
-#include "arch/vtophys.hh"
-#include "kern/kernel_stats.hh"
-#include "mem/vport.hh"
-#else
-#include "params/System.hh"
-#endif
-
using namespace std;
using namespace TheISA;
@@ -65,14 +61,10 @@ vector<System *> System::systemList;
int System::numSystemsRunning = 0;
System::System(Params *p)
- : SimObject(p), physmem(p->physmem), _numContexts(0),
-#if FULL_SYSTEM
+ : SimObject(p), physmem(p->physmem), _numContexts(0), pagePtr(0),
init_param(p->init_param),
loadAddrMask(p->load_addr_mask),
-#else
- pagePtr(0),
nextPID(0),
-#endif
memoryMode(p->mem_mode),
workItemsBegin(0),
workItemsEnd(0),
@@ -93,68 +85,68 @@ System::System(Params *p)
p->memories[x]->size()));
}
-#if FULL_SYSTEM
- kernelSymtab = new SymbolTable;
- if (!debugSymbolTable)
- debugSymbolTable = new SymbolTable;
-
-
- /**
- * Get a functional port to memory
- */
- Port *mem_port;
- functionalPort = new FunctionalPort(name() + "-fport");
- mem_port = physmem->getPort("functional");
- functionalPort->setPeer(mem_port);
- mem_port->setPeer(functionalPort);
-
- virtPort = new VirtualPort(name() + "-fport");
- mem_port = physmem->getPort("functional");
- virtPort->setPeer(mem_port);
- mem_port->setPeer(virtPort);
-
-
- /**
- * Load the kernel code into memory
- */
- if (params()->kernel == "") {
- inform("No kernel set for full system simulation. Assuming you know what"
- " you're doing...\n");
- } else {
- // Load kernel code
- kernel = createObjectFile(params()->kernel);
- inform("kernel located at: %s", params()->kernel);
-
- if (kernel == NULL)
- fatal("Could not load kernel file %s", params()->kernel);
-
- // Load program sections into memory
- kernel->loadSections(functionalPort, loadAddrMask);
-
- // setup entry points
- kernelStart = kernel->textBase();
- kernelEnd = kernel->bssBase() + kernel->bssSize();
- kernelEntry = kernel->entryPoint();
-
- // load symbols
- if (!kernel->loadGlobalSymbols(kernelSymtab))
- fatal("could not load kernel symbols\n");
-
- if (!kernel->loadLocalSymbols(kernelSymtab))
- fatal("could not load kernel local symbols\n");
-
- if (!kernel->loadGlobalSymbols(debugSymbolTable))
- fatal("could not load kernel symbols\n");
-
- if (!kernel->loadLocalSymbols(debugSymbolTable))
- fatal("could not load kernel local symbols\n");
-
- DPRINTF(Loader, "Kernel start = %#x\n", kernelStart);
- DPRINTF(Loader, "Kernel end = %#x\n", kernelEnd);
- DPRINTF(Loader, "Kernel entry = %#x\n", kernelEntry);
- DPRINTF(Loader, "Kernel loaded...\n");
+ if (FullSystem) {
+ kernelSymtab = new SymbolTable;
+ if (!debugSymbolTable)
+ debugSymbolTable = new SymbolTable;
+
+
+ /**
+ * Get a functional port to memory
+ */
+ Port *mem_port;
+ functionalPort = new FunctionalPort(name() + "-fport");
+ mem_port = physmem->getPort("functional");
+ functionalPort->setPeer(mem_port);
+ mem_port->setPeer(functionalPort);
+
+ virtPort = new VirtualPort(name() + "-fport");
+ mem_port = physmem->getPort("functional");
+ virtPort->setPeer(mem_port);
+ mem_port->setPeer(virtPort);
+
+
+ /**
+ * Load the kernel code into memory
+ */
+ if (params()->kernel == "") {
+ inform("No kernel set for full system simulation. "
+ "Assuming you know what you're doing...\n");
+ } else {
+ // Load kernel code
+ kernel = createObjectFile(params()->kernel);
+ inform("kernel located at: %s", params()->kernel);
+
+ if (kernel == NULL)
+ fatal("Could not load kernel file %s", params()->kernel);
+
+ // Load program sections into memory
+ kernel->loadSections(functionalPort, loadAddrMask);
+
+ // setup entry points
+ kernelStart = kernel->textBase();
+ kernelEnd = kernel->bssBase() + kernel->bssSize();
+ kernelEntry = kernel->entryPoint();
+
+ // load symbols
+ if (!kernel->loadGlobalSymbols(kernelSymtab))
+ fatal("could not load kernel symbols\n");
+
+ if (!kernel->loadLocalSymbols(kernelSymtab))
+ fatal("could not load kernel local symbols\n");
+
+ if (!kernel->loadGlobalSymbols(debugSymbolTable))
+ fatal("could not load kernel symbols\n");
+
+ if (!kernel->loadLocalSymbols(debugSymbolTable))
+ fatal("could not load kernel local symbols\n");
+
+ DPRINTF(Loader, "Kernel start = %#x\n", kernelStart);
+ DPRINTF(Loader, "Kernel end = %#x\n", kernelEnd);
+ DPRINTF(Loader, "Kernel entry = %#x\n", kernelEntry);
+ DPRINTF(Loader, "Kernel loaded...\n");
+ }
}
-#endif // FULL_SYSTEM
// increment the number of running systms
numSystemsRunning++;
@@ -164,13 +156,8 @@ System::System(Params *p)
System::~System()
{
-#if FULL_SYSTEM
delete kernelSymtab;
delete kernel;
-#else
- panic("System::fixFuncEventAddr needs to be rewritten "
- "to work with syscall emulation");
-#endif // FULL_SYSTEM}
}
void
@@ -253,11 +240,11 @@ System::numRunningContexts()
void
System::initState()
{
-#if FULL_SYSTEM
- int i;
- for (i = 0; i < threadContexts.size(); i++)
- TheISA::startupCPU(threadContexts[i], i);
-#endif
+ if (FullSystem) {
+ int i;
+ for (i = 0; i < threadContexts.size(); i++)
+ TheISA::startupCPU(threadContexts[i], i);
+ }
}
void
@@ -273,7 +260,6 @@ System::replaceThreadContext(ThreadContext *tc, int context_id)
remoteGDB[context_id]->replaceThreadContext(tc);
}
-#if !FULL_SYSTEM
Addr
System::allocPhysPages(int npages)
{
@@ -296,8 +282,6 @@ System::freeMemSize()
return physmem->size() - (pagePtr << LogVMPageSize);
}
-#endif
-
bool
System::isMemory(const Addr addr) const
{
@@ -319,24 +303,20 @@ System::resume()
void
System::serialize(ostream &os)
{
-#if FULL_SYSTEM
- kernelSymtab->serialize("kernel_symtab", os);
-#else // !FULL_SYSTEM
+ if (FullSystem)
+ kernelSymtab->serialize("kernel_symtab", os);
SERIALIZE_SCALAR(pagePtr);
SERIALIZE_SCALAR(nextPID);
-#endif
}
void
System::unserialize(Checkpoint *cp, const string &section)
{
-#if FULL_SYSTEM
- kernelSymtab->unserialize("kernel_symtab", cp, section);
-#else // !FULL_SYSTEM
+ if (FullSystem)
+ kernelSymtab->unserialize("kernel_symtab", cp, section);
UNSERIALIZE_SCALAR(pagePtr);
UNSERIALIZE_SCALAR(nextPID);
-#endif
}
void
@@ -359,12 +339,8 @@ printSystems()
const char *System::MemoryModeStrings[3] = {"invalid", "atomic",
"timing"};
-#if !FULL_SYSTEM
-
System *
SystemParams::create()
{
return new System(this);
}
-
-#endif
diff --git a/src/sim/system.hh b/src/sim/system.hh
index ed5193dfd..00d8360e0 100644
--- a/src/sim/system.hh
+++ b/src/sim/system.hh
@@ -41,29 +41,22 @@
#include "base/loader/symtab.hh"
#include "base/misc.hh"
#include "base/statistics.hh"
-#include "config/full_system.hh"
#include "cpu/pc_event.hh"
#include "enums/MemoryMode.hh"
+#include "kern/system_events.hh"
#include "mem/port.hh"
#include "params/System.hh"
#include "sim/sim_object.hh"
-#if FULL_SYSTEM
-#include "kern/system_events.hh"
-#endif
-
class BaseCPU;
-class ThreadContext;
+class BaseRemoteGDB;
+class FunctionalPort;
+class GDBListener;
class ObjectFile;
class PhysicalMemory;
-
-#if FULL_SYSTEM
class Platform;
-class FunctionalPort;
+class ThreadContext;
class VirtualPort;
-#endif
-class GDBListener;
-class BaseRemoteGDB;
class System : public SimObject
{
@@ -113,8 +106,8 @@ class System : public SimObject
*/
bool isMemory(const Addr addr) const;
-#if FULL_SYSTEM
- Platform *platform;
+ Addr pagePtr;
+
uint64_t init_param;
/** Port to physical memory used for writing object files into ram at
@@ -145,10 +138,6 @@ class System : public SimObject
*/
Addr loadAddrMask;
-#else
-
- Addr pagePtr;
-
protected:
uint64_t nextPID;
@@ -164,9 +153,6 @@ class System : public SimObject
/** Amount of physical memory that exists */
Addr memSize();
-
-#endif // FULL_SYSTEM
-
protected:
Enums::MemoryMode memoryMode;
uint64_t workItemsBegin;
@@ -212,13 +198,15 @@ class System : public SimObject
return count;
}
-#if FULL_SYSTEM
/**
* Fix up an address used to match PCs for hooking simulator
* events on to target function executions. See comment in
* system.cc for details.
*/
- virtual Addr fixFuncEventAddr(Addr addr) = 0;
+ virtual Addr fixFuncEventAddr(Addr addr)
+ {
+ panic("Base fixFuncEventAddr not implemented.\n");
+ }
/**
* Add a function-based event to the given function, to be looked
@@ -244,7 +232,6 @@ class System : public SimObject
return addFuncEvent<T>(kernelSymtab, lbl);
}
-#endif
public:
std::vector<BaseRemoteGDB *> remoteGDB;
std::vector<GDBListener *> gdbListen;
@@ -266,7 +253,6 @@ class System : public SimObject
public:
-#if FULL_SYSTEM
/**
* Returns the addess the kernel starts at.
* @return address the kernel starts at
@@ -285,14 +271,10 @@ class System : public SimObject
*/
Addr getKernelEntry() const { return kernelEntry; }
-#else
-
/// Allocate npages contiguous unused physical pages
/// @return Starting address of first page
Addr allocPhysPages(int npages);
-#endif // FULL_SYSTEM
-
int registerThreadContext(ThreadContext *tc, int assigned=-1);
void replaceThreadContext(ThreadContext *tc, int context_id);
diff --git a/src/sim/tlb.cc b/src/sim/tlb.cc
index 8cde0db2e..86428f168 100644
--- a/src/sim/tlb.cc
+++ b/src/sim/tlb.cc
@@ -31,23 +31,23 @@
#include "cpu/thread_context.hh"
#include "mem/page_table.hh"
#include "sim/faults.hh"
+#include "sim/full_system.hh"
#include "sim/process.hh"
#include "sim/tlb.hh"
Fault
GenericTLB::translateAtomic(RequestPtr req, ThreadContext *tc, Mode)
{
-#if FULL_SYSTEM
+ if (FullSystem)
panic("Generic translation shouldn't be used in full system mode.\n");
-#else
- Process * p = tc->getProcessPtr();
- Fault fault = p->pTable->translate(req);
- if(fault != NoFault)
- return fault;
+ Process * p = tc->getProcessPtr();
- return NoFault;
-#endif
+ Fault fault = p->pTable->translate(req);
+ if(fault != NoFault)
+ return fault;
+
+ return NoFault;
}
void