diff -r b38e9d40fa8a -r 89e1e226a129 src/sim/System.py --- a/src/sim/System.py Fri Jan 06 13:23:17 2012 +0000 +++ b/src/sim/System.py Fri Jan 06 14:16:07 2012 +0000 @@ -37,8 +37,9 @@ class MemoryMode(Enum): vals = ['invalid', 'atomic', 'timing'] -class System(SimObject): +class System(MemObject): type = 'System' + system_port = Port("System port") @classmethod def export_method_cxx_predecls(cls, code): diff -r b38e9d40fa8a -r 89e1e226a129 src/sim/system.hh --- a/src/sim/system.hh Fri Jan 06 13:23:17 2012 +0000 +++ b/src/sim/system.hh Fri Jan 06 14:16:07 2012 +0000 @@ -44,9 +44,9 @@ #include "config/full_system.hh" #include "cpu/pc_event.hh" #include "enums/MemoryMode.hh" +#include "mem/mem_object.hh" #include "mem/port.hh" #include "params/System.hh" -#include "sim/sim_object.hh" #if FULL_SYSTEM #include "kern/system_events.hh" @@ -65,10 +65,54 @@ class GDBListener; class BaseRemoteGDB; -class System : public SimObject +class System : public MemObject { + private: + + /** + * Private class for the system port which is only used as a + * master for debug access and for non-structural entities that do + * not have a port of their own. + */ + class SystemPort : public Port + { + public: + + /** + * Create a system port with a name and an owner. + */ + SystemPort(const std::string &_name, MemObject *_owner) + : Port(_name, _owner) + { } + bool recvTiming(PacketPtr pkt) + { panic("SystemPort does not receive timing!\n"); return false; } + Tick recvAtomic(PacketPtr pkt) + { panic("SystemPort does not receive atomic!\n"); return 0; } + void recvFunctional(PacketPtr pkt) + { panic("SystemPort does not receive functional!\n"); } + void recvStatusChange(Status status) { } + + }; + + SystemPort _systemPort; + public: + /** + * Get a pointer to the system port that can be used by + * non-structural simulation objects like processes or threads, or + * external entities like loaders and debuggers, etc, to access + * the memory system. + * + * @return a pointer to the system port we own + */ + Port* getSystemPort() { return &_systemPort; } + + /** + * Additional function to return the Port of a memory object. + */ + Port *getPort(const std::string &if_name, int idx = -1); + static const char *MemoryModeStrings[3]; Enums::MemoryMode diff -r b38e9d40fa8a -r 89e1e226a129 src/sim/system.cc --- a/src/sim/system.cc Fri Jan 06 13:23:17 2012 +0000 +++ b/src/sim/system.cc Fri Jan 06 14:16:07 2012 +0000 @@ -65,7 +65,9 @@ int System::numSystemsRunning = 0; System::System(Params *p) - : SimObject(p), physmem(p->physmem), _numContexts(0), + : MemObject(p), _systemPort("system_port", this), + physmem(p->physmem), + _numContexts(0), #if FULL_SYSTEM init_param(p->init_param), loadAddrMask(p->load_addr_mask), @@ -173,6 +175,13 @@ #endif // FULL_SYSTEM} } +Port* +System::getPort(const std::string &if_name, int idx) +{ + // no need to distinguish at the moment (besides checking) + return &_systemPort; +} + void System::setMemoryMode(Enums::MemoryMode mode) {