Lines Matching refs:ehdr
189 Elf64_Ehdr *ehdr = (Elf64_Ehdr *)ehaddr; in rk_dump_elf64_image_phdr() local
195 if (!md_is_uboot_addr((void *)ehdr)) in rk_dump_elf64_image_phdr()
202 memcpy(ehdr->e_ident, ELFMAG, SELFMAG); in rk_dump_elf64_image_phdr()
203 ehdr->e_ident[EI_CLASS] = ELFCLASS64; in rk_dump_elf64_image_phdr()
204 ehdr->e_ident[EI_DATA] = ELFDATA2LSB; in rk_dump_elf64_image_phdr()
205 ehdr->e_ident[EI_VERSION] = EV_CURRENT; in rk_dump_elf64_image_phdr()
206 ehdr->e_ident[EI_OSABI] = ELFOSABI_NONE; in rk_dump_elf64_image_phdr()
208 if (ehdr->e_type != ET_CORE) { in rk_dump_elf64_image_phdr()
210 ehdr->e_type = ET_CORE; in rk_dump_elf64_image_phdr()
212 if (ehdr->e_machine != EM_AARCH64) { in rk_dump_elf64_image_phdr()
214 ehdr->e_machine = EM_AARCH64; in rk_dump_elf64_image_phdr()
216 if (ehdr->e_version != EV_CURRENT) { in rk_dump_elf64_image_phdr()
218 ehdr->e_version = EV_CURRENT; in rk_dump_elf64_image_phdr()
220 if (ehdr->e_ehsize != sizeof(*ehdr)) { in rk_dump_elf64_image_phdr()
222 ehdr->e_ehsize = sizeof(*ehdr); in rk_dump_elf64_image_phdr()
224 if (ehdr->e_phentsize != sizeof(*phdr)) { in rk_dump_elf64_image_phdr()
226 ehdr->e_phentsize = sizeof(*phdr); in rk_dump_elf64_image_phdr()
228 if (ehdr->e_shentsize != sizeof(*shdr)) { in rk_dump_elf64_image_phdr()
230 ehdr->e_shentsize = sizeof(*shdr); in rk_dump_elf64_image_phdr()
232 if (ehdr->e_shoff != sizeof(*ehdr)) { in rk_dump_elf64_image_phdr()
234 ehdr->e_shoff = sizeof(*ehdr); in rk_dump_elf64_image_phdr()
237 phdr_off = sizeof(*ehdr) + (sizeof(*shdr) * MAX_NUM_ENTRIES); in rk_dump_elf64_image_phdr()
239 if (ehdr->e_phoff != phdr_off) { in rk_dump_elf64_image_phdr()
241 ehdr->e_phoff = phdr_off; in rk_dump_elf64_image_phdr()
249 ehdr->e_shstrndx = 1; in rk_dump_elf64_image_phdr()
250 phdr = (Elf64_Phdr *)(ehaddr + ehdr->e_phoff); in rk_dump_elf64_image_phdr()
251 shdr = (Elf64_Shdr *)(ehaddr + ehdr->e_shoff); in rk_dump_elf64_image_phdr()
445 if (ehdr->e_phnum != i) in rk_dump_elf64_image_phdr()
446 ehdr->e_phnum = i; in rk_dump_elf64_image_phdr()
447 if ((ehdr->e_phnum + 3) != ehdr->e_shnum) in rk_dump_elf64_image_phdr()
448 ehdr->e_shnum = ehdr->e_phnum + 3; in rk_dump_elf64_image_phdr()
451 memcpy(ram_image, (void *)ehdr, ehsize); in rk_dump_elf64_image_phdr()
460 Elf32_Ehdr *ehdr = (Elf32_Ehdr *)ehaddr; in rk_dump_elf32_image_phdr() local
461 Elf32_Phdr *phdr = (Elf32_Phdr *)(ehaddr + ehdr->e_phoff); in rk_dump_elf32_image_phdr()
466 memcpy(ram_image, (void *)ehdr, ehsize); in rk_dump_elf32_image_phdr()
469 for (i = 0; i < ehdr->e_phnum; ++i) { in rk_dump_elf32_image_phdr()