elf32-debug.hex2 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. ### Copyright (C) 2016 Jeremiah Orians
  2. ### Copyright (C) 2017 Jan Nieuwenhuizen <janneke@gnu.org>
  3. ### This file is part of stage0.
  4. ###
  5. ### stage0 is free software: you can redistribute it and/or modify
  6. ### it under the terms of the GNU General Public License as published by
  7. ### the Free Software Foundation, either version 3 of the License, or
  8. ### (at your option) any later version.
  9. ###
  10. ### stage0 is distributed in the hope that it will be useful,
  11. ### but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ### GNU General Public License for more details.
  14. ###
  15. ### You should have received a copy of the GNU General Public License
  16. ### along with stage0. If not, see <http://www.gnu.org/licenses/>.
  17. ### stage0's hex2 format for x86
  18. ### !<label> 1 byte relative
  19. ### $<label> 2 byte address
  20. ### @<label> 2 byte relative
  21. ### &<label> 4 byte address
  22. ### %<label> 4 byte relative
  23. ### local_<label> function-local
  24. ### string_<index> string #<index>
  25. ### elf32-header-exit-42.hex2: 32 bit elf header in hex2 for `exit 42'
  26. :ELF_base
  27. 7F 45 4C 46 # e_ident[EI_MAG0-3] ELF's magic number
  28. 01 # e_ident[EI_CLASS] Indicating 32 bit
  29. 01 # e_ident[EI_DATA] Indicating little endianness
  30. 01 # e_ident[EI_VERSION] Indicating original elf
  31. 03 # e_ident[EI_OSABI] Set at 3 because FreeBSD is strict
  32. 00 # e_ident[EI_ABIVERSION] See above
  33. 00 00 00 00 00 00 00 # e_ident[EI_PAD]
  34. 02 00 # e_type Indicating Executable
  35. 03 00 # e_machine Indicating AMD64
  36. 01 00 00 00 # e_version Indicating original elf
  37. &_start # e_entry Address of the entry point
  38. %ELF_program_headers>ELF_base # e_phoff Address of program header table
  39. %ELF_section_headers>ELF_base # e_shoff Address of section header table
  40. 00 00 00 00 # e_flags
  41. 34 00 # e_ehsize Indicating our 52 Byte header
  42. 20 00 # e_phentsize size of a program header table
  43. 01 00 # e_phnum number of entries in program table
  44. 28 00 # e_shentsize size of a section header table
  45. 05 00 # e_shnum number of entries in section table
  46. 02 00 # e_shstrndx index of the section names
  47. :ELF_program_headers
  48. :ELF_program_header__text
  49. 01 00 00 00 # ph_type: PT-LOAD = 1
  50. 00 00 00 00 # ph_offset
  51. &ELF_base # ph_vaddr
  52. &ELF_base # ph_physaddr
  53. %ELF_end>ELF_base # ph_filesz
  54. %ELF_end>ELF_base # ph_memsz
  55. 07 00 00 00 # ph_flags: PF-X|PF-W|PF-R = 7
  56. 01 00 00 00 # ph_align
  57. :ELF_text