iPXE
|
ELF image format. More...
#include <errno.h>
#include <elf.h>
#include <ipxe/uaccess.h>
#include <ipxe/segment.h>
#include <ipxe/image.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, Elf_Phdr *phdr, physaddr_t dest) |
Load ELF segment into memory. More... | |
static int | elf_segment (struct image *image, Elf_Ehdr *ehdr, Elf_Phdr *phdr, int(*process)(struct image *image, Elf_Phdr *phdr, physaddr_t dest), physaddr_t *entry, physaddr_t *max) |
Process ELF segment. More... | |
int | elf_segments (struct image *image, Elf_Ehdr *ehdr, int(*process)(struct image *image, 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 51 of file elf.c.
References buffer, image::data, DBGC, dest, memcpy_user(), Elf32_Phdr::p_filesz, Elf32_Phdr::p_memsz, Elf32_Phdr::p_offset, phys_to_user(), 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 85 of file elf.c.
References DBGC, dest, Elf32_Ehdr::e_entry, end, ENOEXEC, image::len, max, 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, |
Elf_Ehdr * | ehdr, | ||
int(*)(struct image *image, 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 154 of file elf.c.
References copy_from_user(), 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, 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 201 of file elf.c.
References copy_from_user(), 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, max, memcmp(), and rc.
Referenced by elfboot_exec(), and multiboot_load_elf().