changeset 5312e4cb6547 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=5312e4cb6547
description:
        base: Allow multiple interleaved ranges

        This patch changes how the address range calculates intersection such
        that a system can have a number of non-overlapping interleaved ranges
        without complaining. Without this patch we end up with a panic.

diffstat:

 src/base/addr_range.hh |  20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diffs (40 lines):

diff -r 5b58b4cccfd7 -r 5312e4cb6547 src/base/addr_range.hh
--- a/src/base/addr_range.hh    Tue May 26 03:21:39 2015 -0400
+++ b/src/base/addr_range.hh    Tue May 26 03:21:40 2015 -0400
@@ -282,26 +282,26 @@
      */
     bool intersects(const AddrRange& r) const
     {
-        if (!interleaved()) {
-            return _start <= r._end && _end >= r._start;
-        }
+        if (_start > r._end || _end < r._start)
+            // start with the simple case of no overlap at all,
+            // applicable even if we have interleaved ranges
+            return false;
+        else if (!interleaved() && !r.interleaved())
+            // if neither range is interleaved, we are done
+            return true;
 
-        // the current range is interleaved, split the check up in
-        // three cases
+        // now it gets complicated, focus on the cases we care about
         if (r.size() == 1)
             // keep it simple and check if the address is within
             // this range
             return contains(r.start());
-        else if (!r.interleaved())
-            // be conservative and ignore the interleaving
-            return _start <= r._end && _end >= r._start;
         else if (mergesWith(r))
             // restrict the check to ranges that belong to the
             // same chunk
             return intlvMatch == r.intlvMatch;
         else
-            panic("Cannot test intersection of interleaved range %s\n",
-                  to_string());
+            panic("Cannot test intersection of %s and %s\n",
+                  to_string(), r.to_string());
     }
 
     /**
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to