|
iPXE
|
Initial ramdisk (initrd) reshuffling. More...
Go to the source code of this file.
Macros | |
| #define | INITRD_ALIGN 4096 |
| Initial ramdisk chunk alignment. More... | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| void | initrd_reshuffle (void) |
| Reshuffle initrds into desired order at top of memory. More... | |
| int | initrd_region (size_t len, struct memmap_region *region) |
| Calculate post-reshuffle initrd load region. More... | |
| size_t | initrd_load_all (void *address) |
| Load all initrds. More... | |
| static size_t | initrd_align (size_t len) |
| Align initrd length. More... | |
| static size_t | initrd_len (void) |
| Get required length for initrds. More... | |
Initial ramdisk (initrd) reshuffling.
Definition in file initrd.h.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| void initrd_reshuffle | ( | void | ) |
Reshuffle initrds into desired order at top of memory.
After this function returns, the initrds have been rearranged in memory and the external heap structures will have been corrupted. Reshuffling must therefore take place immediately prior to jumping to the loaded OS kernel; no further execution within iPXE is permitted.
Definition at line 229 of file initrd.c.
References end, initrd_dump(), initrd_end, initrd_squash_high(), initrd_swap_any(), start, uheap_end, and uheap_limit.
Referenced by bzimage_load_initrds(), and lkrn_exec().
| int initrd_region | ( | size_t | len, |
| struct memmap_region * | region | ||
| ) |
Calculate post-reshuffle initrd load region.
| len | Length of initrds (from initrd_len()) |
| region | Region descriptor to fill in |
| rc | Return status code |
If successful, then any suitably aligned range within the region may be used as the load address after reshuffling. The caller does not need to call prep_segment() for a range in this region. (Calling prep_segment() would probably fail, since prior to reshuffling the region is still in use by the external heap.)
Definition at line 354 of file initrd.c.
References DBGC, ENOSPC, memmap_region::flags, images, initrd_end, len, memmap_region::max, MEMMAP_FL_MEMORY, min, memmap_region::min, memmap_region::name, uheap_end, and uheap_limit.
Referenced by bzimage_check_initrds(), and lkrn_exec().
| size_t initrd_load_all | ( | void * | address | ) |
Load all initrds.
| address | Load address, or NULL |
| len | Length |
This function is called after the point of no return, when the external heap has been corrupted by reshuffling and there is no way to resume normal execution. The caller must have previously ensured that there is no way for installation to this address to fail.
Definition at line 317 of file initrd.c.
References address, assert(), dest, for_each_image, INITRD_ALIGN, initrd_align(), initrd_load(), len, memset(), NULL, and pad_len.
Referenced by bzimage_load_initrds(), initrd_len(), and lkrn_exec().
Align initrd length.
| len | Length |
| len | Aligned length |
Definition at line 29 of file initrd.h.
References INITRD_ALIGN, and len.
Referenced by initrd_load_all(), initrd_squash_high(), initrd_swap(), initrd_swap_any(), and lkrn_exec().
|
inlinestatic |
Get required length for initrds.
| len | Required length |
Definition at line 40 of file initrd.h.
References initrd_load_all(), and NULL.
1.8.15