about summary refs log tree commit diff stats
path: root/subx/020elf.cc
diff options
context:
space:
mode:
Diffstat (limited to 'subx/020elf.cc')
-rw-r--r--subx/020elf.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/subx/020elf.cc b/subx/020elf.cc
index 7bc6ded8..be6153fc 100644
--- a/subx/020elf.cc
+++ b/subx/020elf.cc
@@ -39,11 +39,11 @@ void load_elf_contents(uint8_t* elf_contents, size_t length) {
   uint32_t p_vaddr = u32_in(&elf_contents[e_phoff + 8]);
   uint32_t p_memsz = u32_in(&elf_contents[e_phoff + 20]);
 
-  Mem.resize(p_memsz);  // TODO: not sure if this should be + p_vaddr
+  Mem.resize(p_vaddr + p_memsz);
   if (length > p_memsz - p_vaddr) length = p_memsz - p_vaddr;
   for (size_t i = 0;  i < length;  ++i)
     Mem.at(p_vaddr + i) = elf_contents[i];
-  End_of_program = p_memsz;
+  End_of_program = p_vaddr + p_memsz;
 
   // TODO: need to set up real stack somewhere