### Copyright (C) 2016 Jeremiah Orians ### Copyright (C) 2017 Jan Nieuwenhuizen ### This file is part of stage0. ### ### stage0 is free software: you an redistribute it and/or modify ### it under the terms of the GNU General Public License as published by ### the Free Software Foundation, either version 3 of the License, or ### (at your option) any later version. ### ### stage0 is distributed in the hope that it will be useful, ### but WITHOUT ANY WARRANTY; without even the implied warranty of ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ### GNU General Public License for more details. ### ### You should have received a copy of the GNU General Public License ### along with stage0. If not, see . ### elf32.hex2: 32 bit elf header in hex2 ## ELF Header 7F 45 4C 46 # e_ident[EI_MAG0-3] ELF's magic number 01 # e_ident[EI_CLASS] Indicating 32 bit 01 # e_ident[EI_DATA] Indicating little endianness 01 # e_ident[EI_VERSION] Indicating original elf 00 # e_ident[EI_OSABI] Set at 0 because none cares 00 # e_ident[EI_ABIVERSION] See above 00 00 00 00 00 00 00 # e_ident[EI_PAD] 02 00 # e_type Indicating Executable 03 00 # e_machine Indicating AMD64 01 00 00 00 # e_version Indicating original elf 54 80 04 08 # e_entry Address of the entry point 34 00 00 00 # e_phoff Address of program header table 00 00 00 00 # e_shoff Address of section header table 00 00 00 00 # e_flags 34 00 # e_ehsize Indicating our 52 Byte header 20 00 # e_phentsize size of a program header table 01 00 # e_phnum number of entries in program table 00 00 # e_shentsize size of a section header table 00 00 # e_shnum number of entries in section table 00 00 # e_shstrndx index of the section names ## Program Header 01 00 00 00 # p_type 00 00 00 00 # p_offset 00 80 04 08 # p_vaddr 00 80 04 08 # p_physaddr ## FIXME! ##60 00 00 00 # p_filesz ##60 00 00 00 # p_memsz #65 01 00 00 # p_filesz #65 01 00 00 # p_memsz 00 20 00 00 # p_filesz 00 20 00 00 # p_memsz 07 00 00 00 # p_flags 01 00 00 00 # alignment ## _start # exit (42) -- works! #bb 2a 00 00 00 # mov $42,%ebx #b8 01 00 00 00 # mov $0x1,%eax #cd 80 # int $0x80