about summary refs log tree commit diff stats
path: root/subx/020elf.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2018-06-27 22:33:55 -0700
committerKartik K. Agaram <vc@akkartik.com>2018-06-27 22:57:13 -0700
commit582875bf3ae0a9e266fe9b49b93b8b8e1748c918 (patch)
tree48fd26835561cbc17a7feb0ae08ee47753a70d4b /subx/020elf.cc
parent3c398ff301cb90f020ed04283c099b9e99146670 (diff)
downloadmu-582875bf3ae0a9e266fe9b49b93b8b8e1748c918.tar.gz
4279 - load_elf() now working on teensy/test5
Turns out it was an open question I never got around to answering.
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