mes/stage0/elf32.hex3

87 lines
3.1 KiB
Scheme

;;; -*-scheme-*-
;;; Copyright (C) 2016 Jeremiah Orians
;;; Copyright (C) 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; 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 <http://www.gnu.org/licenses/>.
;;; elf32.hex3: 32 bit elf header in hex3
;; ELF Header
("*elf-header*"
#X7F #x45 #X4C #x46 ; e_ident[EI_MAG0-3] ELF's magic number
#x01 ; e_ident[EI_CLASS] Indicating 32 bit
#x01 ; e_ident[EI_DATA] Indicating little endianness
#x01 ; e_ident[EI_VERSION] Indicating original elf
#x00 ; e_ident[EI_OSABI] Set at 0 because none cares
#x00 ; e_ident[EI_ABIVERSION] See above
#x00 #x00 #x00 #x00 #x00 #x00 #x00 ; e_ident[EI_PAD]
#x02 #x00 ; e_type Indicating Executable
#x03 #x00 ; e_machine Indicating AMD64
#x01 #x00 #x00 #x00 ; e_version Indicating original elf
#x54 #x80 #x04 #x08 ; e_entry Address of the entry point
#x34 #x00 #x00 #x00 ; e_phoff Address of program header table
#x00 #x00 #x00 #x00 ; e_shoff Address of section header table
#x00 #x00 #x00 #x00 ; e_flags
#x34 #x00 ; e_ehsize Indicating our 52 Byte header
#x20 #x00 ; e_phentsize size of a program header table
#x01 #x00 ; e_phnum number of entries in program table
#x00 #x00 ; e_shentsize size of a section header table
#x00 #x00 ; e_shnum number of entries in section table
#x00 #x00 ; e_shstrndx index of the section names
;; Program Header
#x01 #x00 #x00 #x00 ; p_type
#x00 #x00 #x00 #x00 ; p_offset
#x00 #x80 #x04 #x08 ; p_vaddr
#x00 #x80 #x04 #x08 ; p_physaddr
;; FIXME!
;;#x60 #x00 #x00 #x00 ; p_filesz
;;#x60 #x00 #x00 #x00 ; p_memsz
;#x65 #x01 #x00 #x00 ; p_filesz
;#x65 #x01 #x00 #x00 ; p_memsz
#xff #xff #x00 #x00 ; p_filesz
#xff #xff #x00 #x00 ; p_memsz
#x07 #x00 #x00 #x00 ; p_flags
#x01 #x00 #x00 #x00 ; alignment
;; _start
; exit (42) -- works!
;#xbb #x2a #x00 #x00 #x00 ; mov $42,%ebx
;#xb8 #x01 #x00 #x00 #x00 ; mov $0x1,%eax
;#xcd #x80 ; int $0x80
)
("shstr" 0
#\. #\t #\e #\x #\t 0
#\. #\d #\a #\t #\a 0
#\. #\c #\o #\m #\m #\e #\n #\t 0
#\. #\s #\h #\s #\t #\r #\t #\a #\b 0
#\. #\s #\y #\m #\t #\a #\b 0
#\. #\s #\t #\r #\t #\a #\b 0)