about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-09-29 12:25:28 -0700
committerKartik Agaram <vc@akkartik.com>2018-09-29 17:45:00 -0700
commited79099bf6ad783e4ce040d1e611a9f4ca068d2c (patch)
treefb34b81f62526d6c61fc0a85c7e80e43ae3bc6f9 /subx
parentef79039287b7a76f4fcb0628a6295582d8caf768 (diff)
downloadmu-ed79099bf6ad783e4ce040d1e611a9f4ca068d2c.tar.gz
4617
Diffstat (limited to 'subx')
-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();