iPXE
|
Initial ramdisk (initrd) reshuffling. More...
#include <errno.h>
#include <initrd.h>
#include <ipxe/image.h>
#include <ipxe/uaccess.h>
#include <ipxe/init.h>
#include <ipxe/memblock.h>
#include <ipxe/cpio.h>
Go to the source code of this file.
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static userptr_t | initrd_squash_high (userptr_t top) |
Squash initrds as high as possible in memory. More... | |
static void | initrd_swap (struct image *low, struct image *high, userptr_t free, size_t free_len) |
Swap position of two adjacent initrds. More... | |
static int | initrd_swap_any (userptr_t free, size_t free_len) |
Swap position of any two adjacent initrds not currently in the correct order. More... | |
static void | initrd_dump (void) |
Dump initrd locations (for debug) More... | |
void | initrd_reshuffle (userptr_t bottom) |
Reshuffle initrds into desired order at top of memory. More... | |
int | initrd_reshuffle_check (size_t len, userptr_t bottom) |
Check that there is enough space to reshuffle initrds. More... | |
static void | initrd_startup (void) |
initrd startup function More... | |
struct startup_fn startup_initrd | __startup_fn (STARTUP_LATE) |
initrd startup function More... | |
Variables | |
userptr_t | initrd_top |
Maximum address available for initrd. More... | |
userptr_t | initrd_bottom |
Minimum address available for initrd. More... | |
Initial ramdisk (initrd) reshuffling.
Definition in file initrd.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
Squash initrds as high as possible in memory.
top | Highest possible address |
used | Lowest address used by initrds |
Definition at line 52 of file initrd.c.
References image::data, DBGC, for_each_image, images, INITRD_ALIGN, len, image::len, memcpy_user(), memmove_user(), image::name, NULL, top, user_to_phys(), and userptr_sub().
Referenced by initrd_reshuffle().
|
static |
Swap position of two adjacent initrds.
low | Lower initrd |
high | Higher initrd |
free | Free space |
free_len | Length of free space |
Definition at line 117 of file initrd.c.
References assert(), DBGC, free, high, images, INITRD_ALIGN, len, low, memcpy_user(), memmove_user(), user_to_phys(), and userptr_add().
Referenced by initrd_swap_any().
Swap position of any two adjacent initrds not currently in the correct order.
free | Free space |
free_len | Length of free space |
swapped | A pair of initrds was swapped |
Definition at line 162 of file initrd.c.
References for_each_image, free, high, INITRD_ALIGN, initrd_swap(), low, and userptr_add().
Referenced by initrd_reshuffle().
|
static |
Dump initrd locations (for debug)
Definition at line 202 of file initrd.c.
References image::data, DBG_LOG, DBGC, DBGC2_MD5A, for_each_image, images, image::len, image::name, user_to_phys(), and user_to_virt().
Referenced by initrd_reshuffle().
void initrd_reshuffle | ( | userptr_t | bottom | ) |
Reshuffle initrds into desired order at top of memory.
bottom | Lowest address available for initrds |
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 230 of file initrd.c.
References bottom, DBGC, free, images, initrd_bottom, initrd_dump(), initrd_squash_high(), initrd_swap_any(), initrd_top, top, user_to_phys(), and userptr_sub().
Referenced by bzimage_load_initrds().
Check that there is enough space to reshuffle initrds.
len | Total length of initrds (including padding) |
bottom | Lowest address available for initrds |
rc | Return status code |
Definition at line 267 of file initrd.c.
References bottom, ENOBUFS, initrd_bottom, INITRD_MIN_FREE_LEN, initrd_top, len, top, and userptr_sub().
Referenced by bzimage_check_initrds().
|
static |
initrd startup function
Definition at line 288 of file initrd.c.
References initrd_bottom, initrd_top, largest_memblock(), len, and userptr_add().
struct startup_fn startup_initrd __startup_fn | ( | STARTUP_LATE | ) |
initrd startup function
userptr_t initrd_top |
Maximum address available for initrd.
Definition at line 41 of file initrd.c.
Referenced by initrd_reshuffle(), initrd_reshuffle_check(), and initrd_startup().
userptr_t initrd_bottom |
Minimum address available for initrd.
Definition at line 44 of file initrd.c.
Referenced by initrd_reshuffle(), initrd_reshuffle_check(), and initrd_startup().