summaryrefslogtreecommitdiff
path: root/ecomp-c/tests/asm-i386/elf.asm
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-c/tests/asm-i386/elf.asm')
-rw-r--r--ecomp-c/tests/asm-i386/elf.asm39
1 files changed, 39 insertions, 0 deletions
diff --git a/ecomp-c/tests/asm-i386/elf.asm b/ecomp-c/tests/asm-i386/elf.asm
new file mode 100644
index 0000000..16f40e1
--- /dev/null
+++ b/ecomp-c/tests/asm-i386/elf.asm
@@ -0,0 +1,39 @@
+format binary
+use32
+org $08048000
+ehdr:
+db $7F, "ELF" ; e_ident: magic
+db 1 ; EI_CLASS: ELFCLASS32
+db 1 ; EI_BYTE: ELFDATA2LSB (little endian, 2's complement)
+db 1 ; version of the object file format
+db 0 ; EI_VERSION: EV_CURRENT, ABI version
+dd 0, 0 ; EI_PAD: padding
+dw 2 ; e_type: executable
+dw 3 ; e_machine: Intel 80386
+dd 1 ; e_version: current version
+dd _start ; e_entry: entry address to _start
+dd phdr - $$ ; e_phoff: program header offset at phdr - current position
+dd 0 ; e_shoff, no section header table
+dd 0 ; e_flags
+dw ehdrsize ; e_hsize: header size
+dw phdrsize ; e_phentsize: size of a program header entry
+dw 1 ; e_phnum: 1 entry in the program header table
+dw 0 ; e_shentsize
+dw 0 ; e_shnum
+dw 0 ; e_shstrndx
+ehdrsize = $ - ehdr
+phdr:
+dd 1 ; e_type: PT_LOAD
+dd 0 ; e_offset
+dd $$ ; p_vaddr
+dd 0 ; p_paddr
+dd filesize ; p_filesz
+dd filesize ; p_memsz
+dd 5 ; p_flags: Read & Execute
+dd 0x1000 ; p_align
+phdrsize = $ - phdr
+_start:
+mov eax, 1
+mov ebx, 42
+int $80
+filesize = $ - $$