about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-07-16 20:03:23 -0700
committerKartik Agaram <vc@akkartik.com>2018-07-16 20:03:23 -0700
commita50a95d21505148035ec8f08af414d663e9dad7e (patch)
treefc82b7d9661c94f7b9c0f6eee9a2edc174ea2a6d /subx
parentdc9a126ed663d20d41a2475efca415e0ea23e402 (diff)
downloadmu-a50a95d21505148035ec8f08af414d663e9dad7e.tar.gz
4362
Diffstat (limited to 'subx')
-rw-r--r--subx/020elf.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/subx/020elf.cc b/subx/020elf.cc
index 7121f933..88de65fd 100644
--- a/subx/020elf.cc
+++ b/subx/020elf.cc
@@ -75,6 +75,7 @@ void load_segment_from_program_header(uint8_t* elf_contents, size_t size, uint32
   uint32_t p_offset = u32_in(&elf_contents[offset + 4]);
   uint32_t p_vaddr = u32_in(&elf_contents[offset + 8]);
   if (e_ehsize > p_vaddr) raise << "Invalid binary; program header overlaps ELF header\n" << die();
+  if ((p_vaddr & 0xfffff000) != 0x08048000) raise << "Currently only supporting binaries starting in the default page 0x08048000, but code segment starts at 0x" << HEXWORD << p_vaddr << '\n' << die();
   // unused: p_paddr
   uint32_t p_filesz = u32_in(&elf_contents[offset + 16]);
   uint32_t p_memsz = u32_in(&elf_contents[offset + 20]);