about summary refs log tree commit diff stats
path: root/subx/teensy
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-06-30 21:19:02 -0700
committerKartik Agaram <vc@akkartik.com>2018-06-30 21:32:52 -0700
commit672e0a7e5fe7ab7b5f1e454dbc61c1617867a7a9 (patch)
tree396113ceedbb1e268ae6c60c2d746398173ed748 /subx/teensy
parent3e0c2b7c1345009de3eaaaf26978180b9919b5a1 (diff)
downloadmu-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/teensy')
-rwxr-xr-xsubx/teensy/test5bin99 -> 99 bytes
-rw-r--r--subx/teensy/test5.s10
2 files changed, 5 insertions, 5 deletions
diff --git a/subx/teensy/test5 b/subx/teensy/test5
index a67a5299..b960ac41 100755
--- a/subx/teensy/test5
+++ b/subx/teensy/test5
Binary files differdiff --git a/subx/teensy/test5.s b/subx/teensy/test5.s
index 54a79846..e4bd0c7e 100644
--- a/subx/teensy/test5.s
+++ b/subx/teensy/test5.s
@@ -11,7 +11,7 @@ ehdr:                                                 ; Elf32_Ehdr
               dw      2                               ;   e_type
               dw      3                               ;   e_machine
               dd      1                               ;   e_version
-              dd      _start                          ;   e_entry
+              dd      $$                              ;   e_entry
               dd      phdr - $$                       ;   e_phoff
               dd      0                               ;   e_shoff
               dd      0                               ;   e_flags
@@ -25,11 +25,11 @@ ehdrsize  equ  $ - ehdr
 
 phdr:                                                 ; Elf32_Phdr
               dd      1                               ;   p_type
-              dd      0                               ;   p_offset
+              dd      _start - $$                     ;   p_offset
               dd      $$                              ;   p_vaddr
               dd      $$                              ;   p_paddr
-              dd      filesize                        ;   p_filesz
-              dd      filesize                        ;   p_memsz
+              dd      codesize                        ;   p_filesz
+              dd      codesize                        ;   p_memsz
               dd      5                               ;   p_flags
               dd      0x1000                          ;   p_align
 phdrsize  equ  $ - phdr
@@ -43,4 +43,4 @@ _start:
     dd 0x00000001  ; imm32 operand
   int 0x80
 
-filesize      equ     $ - $$
+codesize      equ     $ - _start