about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-06-27 22:24:12 -0700
committerKartik Agaram <vc@akkartik.com>2018-06-27 22:25:39 -0700
commit3c398ff301cb90f020ed04283c099b9e99146670 (patch)
tree8ef6a10f9c9269d8339afa581dd7daf259d730f6 /subx
parent1d5d645be75691b535fe15e6be9d7855f62dc819 (diff)
downloadmu-3c398ff301cb90f020ed04283c099b9e99146670.tar.gz
4278 - load_elf() isn't actually working yet
Here's a few test binaries generated on 32-bit Linux.
Diffstat (limited to 'subx')
-rw-r--r--subx/teensy/Readme1
-rwxr-xr-xsubx/teensy/test1bin0 -> 5584 bytes
-rw-r--r--subx/teensy/test1.c3
-rwxr-xr-xsubx/teensy/test2bin0 -> 5584 bytes
-rw-r--r--subx/teensy/test2.s9
-rwxr-xr-xsubx/teensy/test3bin0 -> 4848 bytes
-rw-r--r--subx/teensy/test3.s10
-rwxr-xr-xsubx/teensy/test4bin0 -> 368 bytes
-rw-r--r--subx/teensy/test4.s10
-rwxr-xr-xsubx/teensy/test5bin0 -> 91 bytes
-rw-r--r--subx/teensy/test5.s43
11 files changed, 76 insertions, 0 deletions
diff --git a/subx/teensy/Readme b/subx/teensy/Readme
new file mode 100644
index 00000000..7de5f3ca
--- /dev/null
+++ b/subx/teensy/Readme
@@ -0,0 +1 @@
+Test 32-bit ELF binaries.
diff --git a/subx/teensy/test1 b/subx/teensy/test1
new file mode 100755
index 00000000..699edc0d
--- /dev/null
+++ b/subx/teensy/test1
Binary files differdiff --git a/subx/teensy/test1.c b/subx/teensy/test1.c
new file mode 100644
index 00000000..16a9e9b6
--- /dev/null
+++ b/subx/teensy/test1.c
@@ -0,0 +1,3 @@
+// https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
+// gcc -Wall -s test1.c -o test1
+int main() { return 42; }
diff --git a/subx/teensy/test2 b/subx/teensy/test2
new file mode 100755
index 00000000..93b39449
--- /dev/null
+++ b/subx/teensy/test2
Binary files differdiff --git a/subx/teensy/test2.s b/subx/teensy/test2.s
new file mode 100644
index 00000000..c25152e5
--- /dev/null
+++ b/subx/teensy/test2.s
@@ -0,0 +1,9 @@
+; https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
+; nasm -f elf test2.s
+; gcc -Wall -s test2.o -o test2
+BITS 32
+GLOBAL main
+SECTION .text
+main:
+  mov eax, 42
+  ret
diff --git a/subx/teensy/test3 b/subx/teensy/test3
new file mode 100755
index 00000000..365b9ade
--- /dev/null
+++ b/subx/teensy/test3
Binary files differdiff --git a/subx/teensy/test3.s b/subx/teensy/test3.s
new file mode 100644
index 00000000..b00c3cc0
--- /dev/null
+++ b/subx/teensy/test3.s
@@ -0,0 +1,10 @@
+; https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
+; nasm -f elf test3.s
+; gcc -Wall -s -nostartfiles test3.o -o test3
+BITS 32
+EXTERN _exit
+GLOBAL _start
+SECTION .text
+_start:
+  push dword 42
+  call _exit
diff --git a/subx/teensy/test4 b/subx/teensy/test4
new file mode 100755
index 00000000..90e2f7a9
--- /dev/null
+++ b/subx/teensy/test4
Binary files differdiff --git a/subx/teensy/test4.s b/subx/teensy/test4.s
new file mode 100644
index 00000000..c8866dfa
--- /dev/null
+++ b/subx/teensy/test4.s
@@ -0,0 +1,10 @@
+; https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
+; nasm -f elf test4.s
+; gcc -Wall -s -nostdlib test4.o -o test4
+BITS 32
+GLOBAL _start
+SECTION .text
+_start:
+  mov eax, 1
+  mov ebx, 42  
+  int 0x80
diff --git a/subx/teensy/test5 b/subx/teensy/test5
new file mode 100755
index 00000000..da1c8cd6
--- /dev/null
+++ b/subx/teensy/test5
Binary files differdiff --git a/subx/teensy/test5.s b/subx/teensy/test5.s
new file mode 100644
index 00000000..3049615a
--- /dev/null
+++ b/subx/teensy/test5.s
@@ -0,0 +1,43 @@
+; https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
+; nasm -f bin test5.s -o test5
+; chmod +x test5
+BITS 32
+
+              org     0x08048000
+
+ehdr:                                                 ; Elf32_Ehdr
+              db      0x7F, "ELF", 1, 1, 1, 0         ;   e_ident
+      times 8 db      0
+              dw      2                               ;   e_type
+              dw      3                               ;   e_machine
+              dd      1                               ;   e_version
+              dd      _start                          ;   e_entry
+              dd      phdr - $$                       ;   e_phoff
+              dd      0                               ;   e_shoff
+              dd      0                               ;   e_flags
+              dw      ehdrsize                        ;   e_ehsize
+              dw      phdrsize                        ;   e_phentsize
+              dw      1                               ;   e_phnum
+              dw      0                               ;   e_shentsize
+              dw      0                               ;   e_shnum
+              dw      0                               ;   e_shstrndx
+ehdrsize  equ  $ - ehdr
+
+phdr:                                                 ; Elf32_Phdr
+              dd      1                               ;   p_type
+              dd      0                               ;   p_offset
+              dd      $$                              ;   p_vaddr
+              dd      $$                              ;   p_paddr
+              dd      filesize                        ;   p_filesz
+              dd      filesize                        ;   p_memsz
+              dd      5                               ;   p_flags
+              dd      0x1000                          ;   p_align
+phdrsize  equ  $ - phdr
+
+_start:
+  mov     bl, 42
+  xor     eax, eax
+  inc     eax
+  int     0x80
+
+filesize      equ     $ - $$