]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/pkg/bootstrap/server/src/region.cc
update
[l4.git] / l4 / pkg / bootstrap / server / src / region.cc
index ea1b18ff56c8fba56358ff55bc96476a99d17023..77543fe9aee79d69a948fe0d8aa7b5023f53ed71 100644 (file)
@@ -102,6 +102,7 @@ Region_list::add_nolimitcheck(Region const &region, bool may_overlap)
 
   *_end = region;
   ++_end;
+  _combined_size += region.size();
 }
 
 void
@@ -115,22 +116,22 @@ Region_list::add(Region const &region, bool may_overlap)
       return;
     }
 
-  if (mem.begin() >= _upper_limit)
+  if (_combined_size >= _max_combined_size)
     {
-      printf("  Dropping %s region ", _name);
+      printf("  Dropping '%s' region ", _name);
       mem.print();
-      printf(" due to %lld MB limit\n", _upper_limit >> 20);
+      printf(" due to %lld MB limit\n", _max_combined_size >> 20);
       return;
     }
 
-  if (mem.end() >= _upper_limit - 1)
+  if (_combined_size + mem.size() > _max_combined_size)
     {
-      printf("  Limiting %s region ", _name);
+      printf("  Limiting '%s' region ", _name);
       mem.print();
-      mem.end(_upper_limit - 1);
+      mem.end(mem.begin() + _max_combined_size - _combined_size - 1);
       printf(" to ");
       mem.print();
-      printf(" due to %lld MB limit\n", _upper_limit >> 20);
+      printf(" due to %lld MB limit\n", _max_combined_size >> 20);
     }
 
   add_nolimitcheck(mem, may_overlap);
@@ -159,7 +160,7 @@ Region_list::contains(Region const &o)
 void
 Region::print() const
 {
-  printf("  [%9llx, %9llx] {%9llx}", begin(), end(), end() - begin() + 1);
+  printf("  [%9llx, %9llx] {%9llx}", begin(), end(), size());
 }
 
 void