summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/Root.py3
-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/full_system.hh4
-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.cc59
-rw-r--r--src/sim/pseudo_inst.hh67
-rw-r--r--src/sim/root.cc5
-rw-r--r--src/sim/syscall_emul.hh1
-rw-r--r--src/sim/system.cc157
-rw-r--r--src/sim/system.hh41
-rw-r--r--src/sim/tlb.cc16
16 files changed, 159 insertions, 271 deletions
diff --git a/src/sim/Root.py b/src/sim/Root.py
index e15de1554..daa0a903f 100644
--- a/src/sim/Root.py
+++ b/src/sim/Root.py
@@ -28,6 +28,7 @@
# Authors: Nathan Binkert
from m5.SimObject import SimObject
+from m5.defines import buildEnv
from m5.params import *
from m5.util import fatal
@@ -58,6 +59,8 @@ class Root(SimObject):
type = 'Root'
+ full_system = Param.Bool("if this is a full system simulation")
+
# Time syncing prevents the simulation from running faster than real time.
time_sync_enable = Param.Bool(False, "whether time syncing is enabled")
time_sync_period = Param.Clock("100ms", "how often to sync with real time")
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 d34a043c1..73124ecb9 100644
--- a/src/sim/System.py
+++ b/src/sim/System.py
@@ -70,14 +70,10 @@ class System(MemObject):
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/full_system.hh b/src/sim/full_system.hh
index 911648f3a..e67fc11a9 100644
--- a/src/sim/full_system.hh
+++ b/src/sim/full_system.hh
@@ -31,8 +31,6 @@
#ifndef __SIM_FULL_SYSTEM_HH__
#define __SIM_FULL_SYSTEM_HH__
-#include "config/full_system.hh"
-
-static const bool FullSystem = FULL_SYSTEM;
+extern bool FullSystem;
#endif // __SIM_FULL_SYSTEM_HH__
diff --git a/src/sim/process.cc b/src/sim/process.cc
index 31756b01a..8f3b3be79 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;
@@ -724,7 +714,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 2fdedbae1..17b530ab8 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 fe1cdfc34..0fb827498 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,
memProxy->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 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)
{
diff --git a/src/sim/pseudo_inst.hh b/src/sim/pseudo_inst.hh
index ae93c6877..27d3b19d4 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);
@@ -60,71 +58,6 @@ uint64_t writefile(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/root.cc b/src/sim/root.cc
index dd7c12077..c47ada30e 100644
--- a/src/sim/root.cc
+++ b/src/sim/root.cc
@@ -33,6 +33,7 @@
#include "base/misc.hh"
#include "debug/TimeSync.hh"
+#include "sim/full_system.hh"
#include "sim/root.hh"
Root *Root::_root = NULL;
@@ -123,6 +124,8 @@ Root::loadState(Checkpoint *cp)
timeSyncEnable(params()->time_sync_enable);
}
+bool FullSystem;
+
Root *
RootParams::create()
{
@@ -132,5 +135,7 @@ RootParams::create()
created = true;
+ FullSystem = full_system;
+
return new Root(this);
}
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 1c93bcefb..ad00f6e3d 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -65,6 +65,7 @@
#include "mem/se_translating_port_proxy.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 35e6da109..83610a102 100644
--- a/src/sim/system.cc
+++ b/src/sim/system.cc
@@ -48,28 +48,24 @@
#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 "debug/WorkItems.hh"
+#include "kern/kernel_stats.hh"
+#include "mem/fs_translating_port_proxy.hh"
#include "mem/mem_object.hh"
#include "mem/physical.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/fs_translating_port_proxy.hh"
-#else
-#include "params/System.hh"
-#endif
-
using namespace std;
using namespace TheISA;
@@ -81,13 +77,9 @@ System::System(Params *p)
: MemObject(p), _systemPort("system_port", this),
physmem(p->physmem),
_numContexts(0),
-#if FULL_SYSTEM
init_param(p->init_param),
loadAddrMask(p->load_addr_mask),
-#else
- pagePtr(0),
nextPID(0),
-#endif
memoryMode(p->mem_mode),
workItemsBegin(0),
workItemsEnd(0),
@@ -109,28 +101,23 @@ System::System(Params *p)
p->memories[x]->size()));
}
-#if FULL_SYSTEM
- kernelSymtab = new SymbolTable;
- if (!debugSymbolTable)
- debugSymbolTable = new SymbolTable;
+ if (FullSystem) {
+ kernelSymtab = new SymbolTable;
+ if (!debugSymbolTable)
+ debugSymbolTable = new SymbolTable;
- /**
- * Get a port proxy to memory
- */
- physProxy = new PortProxy(*getSystemPort());
- virtProxy = new FSTranslatingPortProxy(*getSystemPort());
-#endif
+ /**
+ * Get a port proxy to memory
+ */
+ physProxy = new PortProxy(*getSystemPort());
+ virtProxy = new FSTranslatingPortProxy(*getSystemPort());
+ }
}
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}
for (uint32_t j = 0; j < numWorkIds; j++)
delete workItemStats[j];
@@ -231,61 +218,64 @@ System::numRunningContexts()
void
System::initState()
{
- // Moved from the constructor to here since it relies on the
- // address map being resolved in the interconnect
-#if FULL_SYSTEM
- /**
- * 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(physProxy, 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");
+ int i;
+ if (FullSystem) {
+ for (i = 0; i < threadContexts.size(); i++)
+ TheISA::startupCPU(threadContexts[i], i);
+ // Moved from the constructor to here since it relies on the
+ // address map being resolved in the interconnect
+ /**
+ * 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(physProxy, 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++;
activeCpus.clear();
-#if FULL_SYSTEM
- int i;
+ if (!FullSystem)
+ return;
+
for (i = 0; i < threadContexts.size(); i++)
TheISA::startupCPU(threadContexts[i], i);
-#endif
}
void
@@ -301,7 +291,6 @@ System::replaceThreadContext(ThreadContext *tc, int context_id)
remoteGDB[context_id]->replaceThreadContext(tc);
}
-#if !FULL_SYSTEM
Addr
System::allocPhysPages(int npages)
{
@@ -324,8 +313,6 @@ System::freeMemSize()
return physmem->size() - (pagePtr << LogVMPageSize);
}
-#endif
-
bool
System::isMemory(const Addr addr) const
{
@@ -347,24 +334,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
@@ -418,12 +401,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 53f1762c7..eb192fb99 100644
--- a/src/sim/system.hh
+++ b/src/sim/system.hh
@@ -53,29 +53,23 @@
#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/mem_object.hh"
#include "mem/port.hh"
#include "params/System.hh"
-#if FULL_SYSTEM
-#include "kern/system_events.hh"
-#endif
-
class BaseCPU;
-class ThreadContext;
+class BaseRemoteGDB;
+class FSTranslatingPortProxy;
+class GDBListener;
class ObjectFile;
class PhysicalMemory;
-
-#if FULL_SYSTEM
class Platform;
class PortProxy;
-class FSTranslatingPortProxy;
-#endif
-class GDBListener;
-class BaseRemoteGDB;
+class ThreadContext;
+class VirtualPort;
class System : public MemObject
{
@@ -181,8 +175,8 @@ class System : public MemObject
*/
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
@@ -213,10 +207,6 @@ class System : public MemObject
*/
Addr loadAddrMask;
-#else
-
- Addr pagePtr;
-
protected:
uint64_t nextPID;
@@ -232,9 +222,6 @@ class System : public MemObject
/** Amount of physical memory that exists */
Addr memSize();
-
-#endif // FULL_SYSTEM
-
protected:
Enums::MemoryMode memoryMode;
uint64_t workItemsBegin;
@@ -290,13 +277,15 @@ class System : public MemObject
void workItemEnd(uint32_t tid, uint32_t workid);
-#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
@@ -322,7 +311,6 @@ class System : public MemObject
return addFuncEvent<T>(kernelSymtab, lbl);
}
-#endif
public:
std::vector<BaseRemoteGDB *> remoteGDB;
std::vector<GDBListener *> gdbListen;
@@ -344,7 +332,6 @@ class System : public MemObject
public:
-#if FULL_SYSTEM
/**
* Returns the addess the kernel starts at.
* @return address the kernel starts at
@@ -363,14 +350,10 @@ class System : public MemObject
*/
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