Skip to content

Instantly share code, notes, and snippets.

@antsaasma
Created May 2, 2012 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antsaasma/2578795 to your computer and use it in GitHub Desktop.
Save antsaasma/2578795 to your computer and use it in GitHub Desktop.
69 byte hello world
BITS 32
org 0x00010000
db 0x7F, "ELF" ; e_ident
dd 1 ; p_type
dd 0 ; p_offset
dd $$ ; p_vaddr
dw 2 ; e_type ; p_paddr
dw 3 ; e_machine
dd _start ; e_version ; p_filesz
dd _start ; e_entry ; p_memsz
dd 4 ; e_phoff ; p_flags
_cont:
mov dl, string_len ; e_shoff ; p_align
int 0x80
mov al, 1 ; e_flags
xor bl,bl
int 0x80 ; e_ehsize
dw 0x20 ; e_phentsize
dw 1 ; e_phnum
_start:
mov al, 04 ; e_shentsize
mov bl, 01 ; e_shnum
mov ecx, string_start ; e_shstrndx
jmp _cont
string_start:
db "Hello world", 0x0a
string_len equ $ - string_start
filesize equ $ - $$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment