diff options
Diffstat (limited to 'src/sim')
-rw-r--r-- | src/sim/System.py | 3 | ||||
-rw-r--r-- | src/sim/system.cc | 21 | ||||
-rw-r--r-- | src/sim/system.hh | 8 |
3 files changed, 31 insertions, 1 deletions
diff --git a/src/sim/System.py b/src/sim/System.py index fd707c353..a6897d834 100644 --- a/src/sim/System.py +++ b/src/sim/System.py @@ -44,8 +44,9 @@ class System(SimObject): def swig_objdecls(cls, code): code('%include "python/swig/system.i"') - physmem = Param.PhysicalMemory(Parent.any, "physical memory") + physmem = Param.PhysicalMemory("Physical Memory") mem_mode = Param.MemoryMode('atomic', "The mode the memory system is in") + memories = VectorParam.PhysicalMemory(Self.all, "All memories is the system") work_item_id = Param.Int(-1, "specific work item id") work_begin_cpu_id_exit = Param.Int(-1, diff --git a/src/sim/system.cc b/src/sim/system.cc index bb8eccf14..81a8a0574 100644 --- a/src/sim/system.cc +++ b/src/sim/system.cc @@ -83,6 +83,16 @@ System::System(Params *p) // add self to global system list systemList.push_back(this); + /** Keep track of all memories we can execute code out of + * in our system + */ + for (int x = 0; x < p->memories.size(); x++) { + if (!p->memories[x]) + continue; + memRanges.push_back(RangeSize(p->memories[x]->start(), + p->memories[x]->size())); + } + #if FULL_SYSTEM kernelSymtab = new SymbolTable; if (!debugSymbolTable) @@ -288,6 +298,17 @@ System::freeMemSize() #endif +bool +System::isMemory(const Addr addr) const +{ + std::list<Range<Addr> >::const_iterator i; + for (i = memRanges.begin(); i != memRanges.end(); i++) { + if (*i == addr) + return true; + } + return false; +} + void System::resume() { diff --git a/src/sim/system.hh b/src/sim/system.hh index 0be16247f..a6bc47fc0 100644 --- a/src/sim/system.hh +++ b/src/sim/system.hh @@ -105,6 +105,14 @@ class System : public SimObject * system. These threads could be Active or Suspended. */ int numRunningContexts(); + /** List to store ranges of memories in this system */ + AddrRangeList memRanges; + + /** check if an address points to valid system memory + * and thus we can fetch instructions out of it + */ + bool isMemory(const Addr addr) const; + #if FULL_SYSTEM Platform *platform; uint64_t init_param; |