SE/FS: Make the system object more consistent between SE and FS.

This commit is contained in:
Gabe Black 2011-10-30 02:30:55 -07:00
parent 1d8822a364
commit 0c81db77f2
3 changed files with 80 additions and 110 deletions

View file

@ -62,8 +62,6 @@ 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")

View file

@ -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;
@ -66,10 +62,8 @@ int System::numSystemsRunning = 0;
System::System(Params *p)
: SimObject(p), physmem(p->physmem), _numContexts(0), pagePtr(0),
#if FULL_SYSTEM
init_param(p->init_param),
loadAddrMask(p->load_addr_mask),
#endif
nextPID(0),
memoryMode(p->mem_mode),
workItemsBegin(0),
@ -91,7 +85,7 @@ System::System(Params *p)
p->memories[x]->size()));
}
#if FULL_SYSTEM
if (FullSystem) {
kernelSymtab = new SymbolTable;
if (!debugSymbolTable)
debugSymbolTable = new SymbolTable;
@ -116,8 +110,8 @@ System::System(Params *p)
* 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");
inform("No kernel set for full system simulation. "
"Assuming you know what you're doing...\n");
} else {
// Load kernel code
kernel = createObjectFile(params()->kernel);
@ -152,7 +146,7 @@ System::System(Params *p)
DPRINTF(Loader, "Kernel entry = %#x\n", kernelEntry);
DPRINTF(Loader, "Kernel loaded...\n");
}
#endif // FULL_SYSTEM
}
// increment the number of running systms
numSystemsRunning++;
@ -162,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
@ -251,11 +240,11 @@ System::numRunningContexts()
void
System::initState()
{
#if FULL_SYSTEM
if (FullSystem) {
int i;
for (i = 0; i < threadContexts.size(); i++)
TheISA::startupCPU(threadContexts[i], i);
#endif
}
}
void
@ -314,9 +303,8 @@ System::resume()
void
System::serialize(ostream &os)
{
#if FULL_SYSTEM
if (FullSystem)
kernelSymtab->serialize("kernel_symtab", os);
#endif
SERIALIZE_SCALAR(pagePtr);
SERIALIZE_SCALAR(nextPID);
}
@ -325,9 +313,8 @@ System::serialize(ostream &os)
void
System::unserialize(Checkpoint *cp, const string &section)
{
#if FULL_SYSTEM
if (FullSystem)
kernelSymtab->unserialize("kernel_symtab", cp, section);
#endif
UNSERIALIZE_SCALAR(pagePtr);
UNSERIALIZE_SCALAR(nextPID);
}
@ -352,12 +339,8 @@ printSystems()
const char *System::MemoryModeStrings[3] = {"invalid", "atomic",
"timing"};
#if !FULL_SYSTEM
System *
SystemParams::create()
{
return new System(this);
}
#endif

View file

@ -44,26 +44,20 @@
#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
{
@ -115,7 +109,6 @@ class System : public SimObject
Addr pagePtr;
#if FULL_SYSTEM
uint64_t init_param;
/** Port to physical memory used for writing object files into ram at
@ -146,8 +139,6 @@ class System : public SimObject
*/
Addr loadAddrMask;
#endif // FULL_SYSTEM
protected:
uint64_t nextPID;
@ -208,13 +199,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
@ -240,7 +233,6 @@ class System : public SimObject
return addFuncEvent<T>(kernelSymtab, lbl);
}
#endif
public:
std::vector<BaseRemoteGDB *> remoteGDB;
std::vector<GDBListener *> gdbListen;
@ -262,7 +254,6 @@ class System : public SimObject
public:
#if FULL_SYSTEM
/**
* Returns the addess the kernel starts at.
* @return address the kernel starts at
@ -281,8 +272,6 @@ class System : public SimObject
*/
Addr getKernelEntry() const { return kernelEntry; }
#endif
Addr new_page();
int registerThreadContext(ThreadContext *tc, int assigned=-1);