about summary refs log tree commit diff stats
path: root/subx/012elf.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-05-10 10:24:24 -0700
committerKartik Agaram <vc@akkartik.com>2019-05-10 11:18:39 -0700
commita1305217980a75ed5534daa7016a83f2d5602b43 (patch)
treedf14066032bef27de441d612eff47c0d88209a6e /subx/012elf.cc
parentfbc21293299f1d5b2d108e3ee98ea4e9083965b5 (diff)
downloadmu-a1305217980a75ed5534daa7016a83f2d5602b43.tar.gz
5149
Tests still broken.
Diffstat (limited to 'subx/012elf.cc')
-rw-r--r--subx/012elf.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/subx/012elf.cc b/subx/012elf.cc
index 6a31826e..11e0e4bc 100644
--- a/subx/012elf.cc
+++ b/subx/012elf.cc
@@ -66,6 +66,7 @@ void load_elf_contents(uint8_t* elf_contents, size_t size, int argc, char* argv[
   assert(overlap.find(STACK_SEGMENT) == overlap.end());
   Mem.push_back(vma(STACK_SEGMENT));
   assert(overlap.find(AFTER_STACK) == overlap.end());
+  // The stack grows downward.
   Reg[ESP].u = AFTER_STACK;
   Reg[EBP].u = 0;
   EIP = e_entry;
@@ -130,10 +131,14 @@ void load_segment_from_program_header(uint8_t* elf_contents, int segment_index,
 
 :(before "End Includes")
 // Very primitive/fixed/insecure ELF segments for now.
-//   code:  0x09000000 -> 0x09ffffff
-//   stack: 0xbe000000 -> 0xb0000000 (downward)
+//   code:  0x09000000 -> 0x09ffffff (specified in ELF binary)
+//   data:  0x0a000000 -> 0x0affffff (specified in ELF binary)
+//   --- heap gets mmap'd somewhere here ---
+//   stack: 0xbdffffff -> 0xbd000000 (downward; not in ELF binary)
+//   argv hack: 0xbf000000 -> 0xc0000000 (not in ELF binary)
 const int CODE_SEGMENT      = 0x09000000;
-const int STACK_SEGMENT     = 0xb0000000;
+const int DATA_SEGMENT =      0x0a000000;
+const int STACK_SEGMENT     = 0xbd000000;
 const int AFTER_STACK       = 0xbe000000;
 const int ARGV_DATA_SEGMENT = 0xbf000000;
 :(before "End Dump Info for Instruction")