diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-06-30 21:19:02 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-06-30 21:32:52 -0700 |
commit | 672e0a7e5fe7ab7b5f1e454dbc61c1617867a7a9 (patch) | |
tree | 396113ceedbb1e268ae6c60c2d746398173ed748 /subx/021translate.cc | |
parent | 3e0c2b7c1345009de3eaaaf26978180b9919b5a1 (diff) | |
download | mu-672e0a7e5fe7ab7b5f1e454dbc61c1617867a7a9.tar.gz |
4291 - stop copying the ELF header into memory
No need for it once the program's loaded. And we keep programs from running the header as code. This also simplifies the header computation in the translator.
Diffstat (limited to 'subx/021translate.cc')
-rw-r--r-- | subx/021translate.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/subx/021translate.cc b/subx/021translate.cc index ae110c21..94553ae9 100644 --- a/subx/021translate.cc +++ b/subx/021translate.cc @@ -41,7 +41,7 @@ void dump_elf_header(ostream& out) { // e_version O(0x01); O(0x00); O(0x00); O(0x00); // e_entry - int e_entry = START + /*size of ehdr*/52 + /*size of phdr*/32; + int e_entry = START; emit(e_entry); // e_phoff -- immediately after ELF header int e_phoff = 52; @@ -73,14 +73,14 @@ void dump_elf_header(ostream& out) { uint32_t p_type = 0x1; emit(p_type); // p_offset - uint32_t p_offset = 0; + uint32_t p_offset = /*size of ehdr*/52 + /*size of phdr*/32; emit(p_offset); // p_vaddr emit(START); // p_paddr emit(START); // p_filesz - uint32_t size = (End_of_program-/*we're not using location 0*/1) + /*size of ehdr*/52 + /*size of phdr*/32; + uint32_t size = End_of_program - /*we're not using location 0*/1; emit(size); // p_memsz emit(size); |