1 /* 2 * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230) 3 * 4 * SPDX-License-Identifier: GPL-2.0-only 5 */ 6 7 #pragma once 8 9 #include <types.h> 10 11 /* minimal ELF structures needed for loading GRUB boot module */ 12 typedef struct Elf64_Header { 13 unsigned char e_ident[16]; 14 uint16_t e_type; 15 uint16_t e_machine; 16 uint32_t e_version; 17 uint64_t e_entry; 18 uint64_t e_phoff; 19 uint64_t e_shoff; 20 uint32_t e_flags; 21 uint16_t e_ehsize; 22 uint16_t e_phentsize; 23 uint16_t e_phnum; 24 uint16_t e_shentsize; 25 uint16_t e_shnum; 26 uint16_t e_shstrndx; 27 } Elf64_Header_t, Elf_Header_t; 28 29 typedef struct Elf64_Phdr { 30 uint32_t p_type; 31 uint32_t p_flags; 32 uint64_t p_offset; 33 uint64_t p_vaddr; 34 uint64_t p_paddr; 35 uint64_t p_filesz; 36 uint64_t p_memsz; 37 uint64_t p_align; 38 } Elf64_Phdr_t, Elf_Phdr_t; 39 40