Yu-hsin Wang has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/48868 )

Change subject: fastmodel: replace memory space id lookup with getMemorySpaceId
......................................................................

fastmodel: replace memory space id lookup with getMemorySpaceId

Change-Id: Ib16ea3b92dadc149461fc40f8d85554b7afed656
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48868
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Gabe Black <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/arch/arm/fastmodel/CortexA76/thread_context.cc
M src/arch/arm/fastmodel/CortexR52/thread_context.cc
2 files changed, 18 insertions(+), 34 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/arch/arm/fastmodel/CortexA76/thread_context.cc b/src/arch/arm/fastmodel/CortexA76/thread_context.cc
index 47e5ab0..735e06d 100644
--- a/src/arch/arm/fastmodel/CortexA76/thread_context.cc
+++ b/src/arch/arm/fastmodel/CortexA76/thread_context.cc
@@ -67,15 +67,8 @@
         Iris::PhysicalMemorySecureMsn : Iris::PhysicalMemoryNonSecureMsn;

     // Figure out what memory spaces match the canonical numbers we need.
-    iris::MemorySpaceId in = iris::IRIS_UINT64_MAX;
-    iris::MemorySpaceId out = iris::IRIS_UINT64_MAX;
-
-    for (auto &space: memorySpaces) {
-        if (space.canonicalMsn == in_msn)
-            in = space.spaceId;
-        else if (space.canonicalMsn == out_msn)
-            out = space.spaceId;
-    }
+    iris::MemorySpaceId in = getMemorySpaceId(in_msn);
+    iris::MemorySpaceId out = getMemorySpaceId(out_msn);

     panic_if(in == iris::IRIS_UINT64_MAX || out == iris::IRIS_UINT64_MAX,
             "Canonical IRIS memory space numbers not found.");
@@ -188,14 +181,13 @@
 CortexA76TC::getBpSpaceIds() const
 {
     if (bpSpaceIds.empty()) {
-        for (auto &space: memorySpaces) {
-            auto cmsn = space.canonicalMsn;
-            if (cmsn == Iris::SecureMonitorMsn ||
-                    cmsn == Iris::GuestMsn ||
-                    cmsn == Iris::NsHypMsn ||
-                    cmsn == Iris::HypAppMsn) {
-                bpSpaceIds.push_back(space.spaceId);
-            }
+        std::vector<Iris::CanonicalMsn> msns{
+            Iris::SecureMonitorMsn, Iris::GuestMsn, Iris::NsHypMsn,
+            Iris::HypAppMsn};
+        for (auto &msn : msns) {
+            auto id = getMemorySpaceId(msn);
+            if (id != iris::IRIS_UINT64_MAX)
+                bpSpaceIds.push_back(id);
         }
         panic_if(bpSpaceIds.empty(),
                 "Unable to find address space(s) for breakpoints.");
diff --git a/src/arch/arm/fastmodel/CortexR52/thread_context.cc b/src/arch/arm/fastmodel/CortexR52/thread_context.cc
index 5bedf5a..0f2dfa0 100644
--- a/src/arch/arm/fastmodel/CortexR52/thread_context.cc
+++ b/src/arch/arm/fastmodel/CortexR52/thread_context.cc
@@ -67,15 +67,8 @@
         Iris::PhysicalMemorySecureMsn : Iris::PhysicalMemoryNonSecureMsn;

     // Figure out what memory spaces match the canonical numbers we need.
-    iris::MemorySpaceId in = iris::IRIS_UINT64_MAX;
-    iris::MemorySpaceId out = iris::IRIS_UINT64_MAX;
-
-    for (auto &space: memorySpaces) {
-        if (space.canonicalMsn == in_msn)
-            in = space.spaceId;
-        else if (space.canonicalMsn == out_msn)
-            out = space.spaceId;
-    }
+    iris::MemorySpaceId in = getMemorySpaceId(in_msn);
+    iris::MemorySpaceId out = getMemorySpaceId(out_msn);

     panic_if(in == iris::IRIS_UINT64_MAX || out == iris::IRIS_UINT64_MAX,
             "Canonical IRIS memory space numbers not found.");
@@ -155,14 +148,13 @@
 CortexR52TC::getBpSpaceIds() const
 {
     if (bpSpaceIds.empty()) {
-        for (auto &space: memorySpaces) {
-            auto cmsn = space.canonicalMsn;
-            if (cmsn == Iris::SecureMonitorMsn ||
-                    cmsn == Iris::GuestMsn ||
-                    cmsn == Iris::NsHypMsn ||
-                    cmsn == Iris::HypAppMsn) {
-                bpSpaceIds.push_back(space.spaceId);
-            }
+        std::vector<Iris::CanonicalMsn> msns{
+            Iris::SecureMonitorMsn, Iris::GuestMsn, Iris::NsHypMsn,
+            Iris::HypAppMsn};
+        for (auto &msn : msns) {
+            auto id = getMemorySpaceId(msn);
+            if (id != iris::IRIS_UINT64_MAX)
+                bpSpaceIds.push_back(id);
         }
         panic_if(bpSpaceIds.empty(),
                 "Unable to find address space(s) for breakpoints.");

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/48868
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: Ib16ea3b92dadc149461fc40f8d85554b7afed656
Gerrit-Change-Number: 48868
Gerrit-PatchSet: 2
Gerrit-Owner: Yu-hsin Wang <[email protected]>
Gerrit-Reviewer: Earl Ou <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Yu-hsin Wang <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to