fastmodel: add memory space id map and getter
Change-Id: Ia9bd467b72ed59ba2b3d2aaf402761779c4e76e9 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48867 Reviewed-by: Gabe Black <gabe.black@gmail.com> Maintainer: Gabe Black <gabe.black@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "arch/arm/fastmodel/iris/cpu.hh"
|
||||
#include "arch/arm/fastmodel/iris/memory_spaces.hh"
|
||||
#include "arch/arm/system.hh"
|
||||
#include "arch/arm/utility.hh"
|
||||
#include "base/logging.hh"
|
||||
@@ -70,6 +71,10 @@ ThreadContext::initFromIrisInstance(const ResourceMap &resources)
|
||||
suspend();
|
||||
|
||||
call().memory_getMemorySpaces(_instId, memorySpaces);
|
||||
for (const auto &space: memorySpaces) {
|
||||
memorySpaceIds.emplace(
|
||||
Iris::CanonicalMsn(space.canonicalMsn), space.spaceId);
|
||||
}
|
||||
call().memory_getUsefulAddressTranslations(_instId, translations);
|
||||
|
||||
typedef ThreadContext Self;
|
||||
@@ -120,6 +125,13 @@ ThreadContext::extractResourceMap(
|
||||
}
|
||||
}
|
||||
|
||||
iris::MemorySpaceId
|
||||
ThreadContext::getMemorySpaceId(const Iris::CanonicalMsn& msn) const
|
||||
{
|
||||
auto it = memorySpaceIds.find(msn);
|
||||
return it == memorySpaceIds.end() ? iris::IRIS_UINT64_MAX : it->second;
|
||||
}
|
||||
|
||||
void
|
||||
ThreadContext::maintainStepping()
|
||||
{
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "arch/arm/fastmodel/iris/memory_spaces.hh"
|
||||
#include "arch/arm/regs/vec.hh"
|
||||
#include "cpu/base.hh"
|
||||
#include "cpu/thread_context.hh"
|
||||
@@ -56,6 +58,9 @@ class ThreadContext : public gem5::ThreadContext
|
||||
typedef std::vector<iris::ResourceId> ResourceIds;
|
||||
typedef std::map<int, std::string> IdxNameMap;
|
||||
|
||||
typedef std::unordered_map<Iris::CanonicalMsn, iris::MemorySpaceId>
|
||||
MemorySpaceMap;
|
||||
|
||||
protected:
|
||||
gem5::BaseCPU *_cpu;
|
||||
int _threadId;
|
||||
@@ -81,6 +86,7 @@ class ThreadContext : public gem5::ThreadContext
|
||||
const ResourceMap &resources, const std::string &name);
|
||||
void extractResourceMap(ResourceIds &ids,
|
||||
const ResourceMap &resources, const IdxNameMap &idx_names);
|
||||
iris::MemorySpaceId getMemorySpaceId(const Iris::CanonicalMsn& msn) const;
|
||||
|
||||
|
||||
ResourceIds miscRegIds;
|
||||
@@ -97,6 +103,7 @@ class ThreadContext : public gem5::ThreadContext
|
||||
|
||||
std::vector<iris::MemorySpaceInfo> memorySpaces;
|
||||
std::vector<iris::MemorySupportedAddressTranslationResult> translations;
|
||||
MemorySpaceMap memorySpaceIds;
|
||||
|
||||
// A queue to keep track of instruction count based events.
|
||||
EventQueue comInstEventQueue;
|
||||
|
||||
Reference in New Issue
Block a user