|
iPXE
|
ELF image format. More...
#include <string.h>#include <errno.h>#include <elf.h>#include <ipxe/segment.h>#include <ipxe/image.h>#include <ipxe/uaccess.h>#include <ipxe/elf.h>Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| static int | elf_load_segment (struct image *image, const Elf_Phdr *phdr, physaddr_t dest) |
| Load ELF segment into memory. More... | |
| static int | elf_segment (struct image *image, const Elf_Ehdr *ehdr, const Elf_Phdr *phdr, int(*process)(struct image *image, const Elf_Phdr *phdr, physaddr_t dest), physaddr_t *entry, physaddr_t *max) |
| Process ELF segment. More... | |
| int | elf_segments (struct image *image, const Elf_Ehdr *ehdr, int(*process)(struct image *image, const Elf_Phdr *phdr, physaddr_t dest), physaddr_t *entry, physaddr_t *max) |
| Process ELF segments. More... | |
| int | elf_load (struct image *image, physaddr_t *entry, physaddr_t *max) |
| Load ELF image into memory. More... | |
ELF image format.
A "pure" ELF image is not a bootable image. There are various bootable formats based upon ELF (e.g. Multiboot), which share common ELF-related functionality.
Definition in file elf.c.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Load ELF segment into memory.
| image | ELF file |
| phdr | ELF program header |
| dest | Destination address |
| rc | Return status code |
Definition at line 52 of file elf.c.
References buffer, image::data, DBGC, dest, memcpy(), image::name, Elf32_Phdr::p_filesz, Elf32_Phdr::p_memsz, Elf32_Phdr::p_offset, prep_segment(), rc, and strerror().
Referenced by elf_load().
|
static |
Process ELF segment.
| image | ELF file |
| ehdr | ELF executable header |
| phdr | ELF program header |
| process | Segment processor |
| entry | Entry point, if found |
| max | Maximum used address |
| rc | Return status code |
Definition at line 86 of file elf.c.
References DBGC, dest, Elf32_Ehdr::e_entry, end, ENOEXEC, image::len, max, image::name, Elf32_Phdr::p_filesz, Elf32_Phdr::p_memsz, Elf32_Phdr::p_offset, Elf32_Phdr::p_paddr, Elf32_Phdr::p_type, Elf32_Phdr::p_vaddr, PT_LOAD, and rc.
Referenced by elf_segments().
| int elf_segments | ( | struct image * | image, |
| const Elf_Ehdr * | ehdr, | ||
| int(*)(struct image *image, const Elf_Phdr *phdr, physaddr_t dest) | process, | ||
| physaddr_t * | entry, | ||
| physaddr_t * | max | ||
| ) |
Process ELF segments.
| image | ELF file |
| ehdr | ELF executable header |
| process | Segment processor |
| entry | Entry point, if found |
| max | Maximum used address |
| rc | Return status code |
Definition at line 157 of file elf.c.
References image::data, DBGC, Elf32_Ehdr::e_entry, Elf32_Ehdr::e_phentsize, Elf32_Ehdr::e_phnum, Elf32_Ehdr::e_phoff, elf_segment(), ENOEXEC, image::len, max, image::name, and rc.
Referenced by elf_load(), and elfboot_probe().
| int elf_load | ( | struct image * | image, |
| physaddr_t * | entry, | ||
| physaddr_t * | max | ||
| ) |
Load ELF image into memory.
| image | ELF file |
| entry | Entry point |
| max | Maximum used address |
| rc | Return status code |
Definition at line 206 of file elf.c.
References image::data, DBGC, Elf32_Ehdr::e_ident, EI_CLASS, EI_MAG0, EI_MAG1, EI_MAG2, EI_MAG3, elf_load_segment(), elf_segments(), ELFCLASS, ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3, ENOEXEC, image::len, max, memcmp(), image::name, and rc.
Referenced by elfboot_exec(), and multiboot_load_elf().
1.8.15