about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--subx/010---vm.cc7
-rw-r--r--subx/011run.cc2
2 files changed, 7 insertions, 2 deletions
diff --git a/subx/010---vm.cc b/subx/010---vm.cc
index c862ed99..388fb12b 100644
--- a/subx/010---vm.cc
+++ b/subx/010---vm.cc
@@ -94,8 +94,8 @@ const uint32_t INITIAL_SEGMENT_SIZE = 0x1000 - 1;
 // Subtract one just so we can start the first segment at address 1 without
 // overflowing the first segment. Other segments will learn to adjust.
 
-// Like in real-world Linux, we'll allocate RAM for our programs in slabs
-// called VMAs or Virtual Memory Areas.
+// Like in real-world Linux, we'll allocate RAM for our programs in disjoint
+// slabs called VMAs or Virtual Memory Areas.
 struct vma {
   uint32_t start;  // inclusive
   uint32_t end;  // exclusive
@@ -126,6 +126,9 @@ struct vma {
 
 :(before "End Globals")
 // RAM is made of VMAs.
+//
+// We currently have zero tests for overlapping VMAs. Particularly after
+// growing segments.
 vector<vma> Mem;
 :(code)
 // The first 3 VMAs are special. When loading ELF binaries in later layers,
diff --git a/subx/011run.cc b/subx/011run.cc
index 22eaad9d..b3fc7684 100644
--- a/subx/011run.cc
+++ b/subx/011run.cc
@@ -224,6 +224,8 @@ void load(const program& p) {
   for (int i = 0;   i < SIZE(p.segments);  ++i) {
     const segment& seg = p.segments.at(i);
     uint32_t addr = seg.start;
+    // you should probably keep your segments disjoint
+    // but tests sometimes don't
     if (!already_allocated(addr))
       Mem.push_back(vma(seg.start));
     trace(99, "load") << "loading segment " << i << " from " << HEXWORD << addr << end();