; ARM32 ELF quine ; i made an x86 one but that's boring ; also fuck GNU tools i have no idea how to make them work for this ; compile with: ; vasmarm_std -Fbin -a4t -o quine quine.asm .org 0x20000 ehdr: ; Elf32_Ehdr .byte 0x7F, "ELF", 1, 1, 1, 0 ; e_ident .byte 0, 0, 0, 0, 0, 0, 0, 0 .2byte 2 ; e_type - executable .2byte 40 ; e_machine - EM_ARM .4byte 1 ; e_version .4byte _start ; e_entry .4byte ehdrsize ; e_phoff .4byte 0 ; e_shoff .4byte 0x05000200 ; e_flags - (pretend to be eabi5, soft float ; what could possibly go wrong???) .2byte ehdrsize ; e_ehsize .2byte phdrsize ; e_phentsize .2byte 1 ; e_phnum - only 1 program header .2byte 0 ; e_shentsize - no section headers .2byte 0 ; e_shnum .2byte 0 ; e_shstrndx .set ehdrsize, phdr - ehdr phdr: ; Elf32_Phdr .4byte 1 ; p_type - PROGBITS .4byte 0 ; p_offset - start at the beginning of the ELF .4byte ehdr ; p_vaddr .4byte ehdr ; p_paddr .4byte filesize ; p_filesz - map the whole ELF into memory .4byte filesize ; p_memsz .4byte 5 ; p_flags - r-x .4byte 0x1000 ; p_align - align to page .set phdrsize, _start - phdr _start: mov r7, #4 ; SYS_write mov r0, #1 ; fd = stdout mov r1, #ehdr ; buf = start of program memory mov r2, #filesize ; count = program size svc 0 mov r7, #1 ; SYS_exit mov r0, #42 ; status svc 0 fileend: .set filesize, fileend - ehdr