ELF image format.
Definition in file elf.h.
Process ELF segments.
- Parameters
-
| image | ELF file |
| ehdr | ELF executable header |
| process | Segment processor |
- Return values
-
| entry | Entry point, if found |
| max | Maximum used address |
| rc | Return status code |
Definition at line 157 of file elf.c.
177 ( (
image->
len - phoff ) < sizeof ( *phdr ) ) ) {
178 DBGC (
image,
"ELF %s program header %d outside " 184 entry,
max ) ) != 0 )
190 DBGC (
image,
"ELF %s entry point %lx outside image\n",
struct arbelprm_rc_send_wqe rc
const void * data
Read-only data.
#define ENOEXEC
Exec format error.
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.
size_t len
Length of raw file image.
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().
Load ELF image into memory.
- Parameters
-
- Return values
-
| entry | Entry point |
| max | Maximum used address |
| rc | Return status code |
Definition at line 206 of file elf.c.
207 static const uint8_t e_ident[] = {
218 if (
image->
len < sizeof ( *ehdr ) ) {
219 DBGC (
image,
"ELF %s too short for ELF header\n",
224 if (
memcmp ( ehdr->
e_ident, e_ident, sizeof ( e_ident ) ) != 0 ) {
231 entry,
max ) ) != 0 )
struct arbelprm_rc_send_wqe rc
const void * data
Read-only data.
#define ENOEXEC
Exec format error.
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.
unsigned char e_ident[EI_NIDENT]
size_t len
Length of raw file image.
static int elf_load_segment(struct image *image, const Elf_Phdr *phdr, physaddr_t dest)
Load ELF segment into memory.
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
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().