Yu-hsin Wang has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/45268 )
Change subject: fastmodel: add iris readMem and writeMem function
......................................................................
fastmodel: add iris readMem and writeMem function
Iris memory API allows us to access the memory inside the core, for
example the tightly coupled memory (TCM). If we access a memory address
which is not in the CPU, it also fire a request to memory system.
Change-Id: I5925214534a10e3a55b780c3d4ed06e7559aafe0
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45268
Reviewed-by: Gabe Black <gabebl...@google.com>
Maintainer: Gabe Black <gabebl...@google.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/arch/arm/fastmodel/iris/thread_context.cc
M src/arch/arm/fastmodel/iris/thread_context.hh
2 files changed, 25 insertions(+), 0 deletions(-)
Approvals:
Gabe Black: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/arch/arm/fastmodel/iris/thread_context.cc
b/src/arch/arm/fastmodel/iris/thread_context.cc
index e2b32f4..716ffad 100644
--- a/src/arch/arm/fastmodel/iris/thread_context.cc
+++ b/src/arch/arm/fastmodel/iris/thread_context.cc
@@ -39,11 +39,15 @@
#include "arch/arm/fastmodel/iris/thread_context.hh"
+#include <cstdint>
+#include <cstring>
#include <utility>
+#include <vector>
#include "arch/arm/fastmodel/iris/cpu.hh"
#include "arch/arm/system.hh"
#include "arch/arm/utility.hh"
+#include "base/logging.hh"
#include "iris/detail/IrisCppAdapter.h"
#include "iris/detail/IrisObjects.h"
#include "mem/se_translating_port_proxy.hh"
@@ -420,6 +424,25 @@
return true;
}
+void
+ThreadContext::readMem(Addr addr, void *p, size_t size)
+{
+ iris::r0master::MemoryReadResult r;
+ auto err = call().memory_read(_instId, r, 0, addr, 1, size);
+ panic_if(err != iris::r0master::E_ok, "readMem failed.");
+ std::memcpy(p, r.data.data(), size);
+}
+
+void
+ThreadContext::writeMem(Addr addr, const void *p, size_t size)
+{
+ std::vector<uint64_t> data((size + 7) / 8);
+ std::memcpy(data.data(), p, size);
+ iris::MemoryWriteResult r;
+ auto err = call().memory_write(_instId, r, 0, addr, 1, size, data);
+ panic_if(err != iris::r0master::E_ok, "writeMem failed.");
+}
+
bool
ThreadContext::translateAddress(Addr &paddr, iris::MemorySpaceId p_space,
Addr vaddr, iris::MemorySpaceId v_space)
diff --git a/src/arch/arm/fastmodel/iris/thread_context.hh
b/src/arch/arm/fastmodel/iris/thread_context.hh
index eadd089..d16b480 100644
--- a/src/arch/arm/fastmodel/iris/thread_context.hh
+++ b/src/arch/arm/fastmodel/iris/thread_context.hh
@@ -162,6 +162,8 @@
iris::IrisCppAdapter &call() const { return client.irisCall(); }
iris::IrisCppAdapter &noThrow() const { return
client.irisCallNoThrow(); }
+ void readMem(Addr addr, void *p, size_t size);
+ void writeMem(Addr addr, const void *p, size_t size);
bool translateAddress(Addr &paddr, iris::MemorySpaceId p_space,
Addr vaddr, iris::MemorySpaceId v_space);
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/45268
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I5925214534a10e3a55b780c3d4ed06e7559aafe0
Gerrit-Change-Number: 45268
Gerrit-PatchSet: 10
Gerrit-Owner: Yu-hsin Wang <yuhsi...@google.com>
Gerrit-Reviewer: Earl Ou <shunhsin...@google.com>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Philip Metzler <cpm...@google.com>
Gerrit-Reviewer: Yu-hsin Wang <yuhsi...@google.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s